Please follow the below template, it will help us to help you!
Standard Install on Ubuntu 22.04 lts using simple ssh script.
I created custom php File within /var/www/html/export.php
From the moment I try to use new PDO() the script can no longer be used over Browser. Error Code is 500. Calling "php export.php" within ssh shell works excellent.