Is it possible to run a PHP program from a cron job? I am trying to do this, and have set up a cron job to run
once per day at 3am. It attempts to do it, but fails as follows:
[06-Apr-2017 20:49:33 America/Detroit] PHP Warning: require_once(basic_init.php): failed to open stream: No such file or directory in /home/xxxx/public_html/swchoir/index.php on line 2
[06-Apr-2017 20:49:33 America/Detroit] PHP Fatal error: require_once(): Failed opening required 'basic_init.php' (include_path='.:/opt/cpanel/ea-php56/root/usr/share/pear') in /home/xxxx/public_html/swchoir/index.php on line 2
My first question is, why is it trying to run index.php, which is my default page, but is not involved in do-email.php at all, as far as I can see.
The second question is why is the include path set to '.:/opt/cpanel/ea-php56/root/usr/share/pear'?
I have the following in my php.ini file:
include_path = ".:/home/myaccount/include:/usr/lib/php:/usr/local/lib/php"
Which works fine when running the PHP files as part of web pages, but it seems that this is not working in a cron job.
I hope you can help me put my finger on why this is not working.
Thank you - Rowan
Edited by TCH-Bala, 10 April 2017 - 07:47 PM.
Please do not add sensitive information like domain and home directory paths on a public forum