I've got a script that creating a pdf file from data in my database and sends a report via email. It works perfectly fine when run from a browser but fails when I run it as a cron job (Plesk scheduled task).
I've narrowed the issue down to the first few lines of code by creating a stripped down version of the script that also has the same behaviour. The total content of the file is four lines, as below:
The script fails with the errors below:
Of course the pdf_mc_table.php file is located in the specified location.
TIA
I've narrowed the issue down to the first few lines of code by creating a stripped down version of the script that also has the same behaviour. The total content of the file is four lines, as below:
PHP:
ob_start();
require '/var/www/vhosts/mydomain.com/customer/sm/inc/_global/db_con.php';
require '/var/www/vhosts/compleit.com/customer/test/fpdf/pdf_mc_table.php';
echo "ok";
The script fails with the errors below:
Code:
PHP Warning: require(../fpdf/pdf_mc_table.php): failed to open stream: No such file or directory in /var/www/vhosts/compleit.com/customer/test/cron/data_check2.php on line 5
PHP Warning: require(../fpdf/pdf_mc_table.php): failed to open stream: No such file or directory in /var/www/vhosts/compleit.com/customer/test/cron/data_check2.php on line 5
PHP Fatal error: require(): Failed opening required '../fpdf/pdf_mc_table.php' (include_path='.:/opt/plesk/php/7.3/share/pear') in /var/www/vhosts/...
Of course the pdf_mc_table.php file is located in the specified location.
TIA