Crons Suddenly Can't include PHP files
AnsweredFor years I've been running dozens of PHP scripts via cron. They perform many essential functions for our business.
But yesterday morning at 6:00am all of them suddenly could no longer access include files that exist outside of their home directory .
The error i get is - PHP Warning: include(): Failed opening '/home/xxx/public_html/xxx/xxx.php' for inclusion (include_path='.:/opt/cpanel/ea-php82/root/usr/share/pear') in /home/xxx/public_html/xxx/yyy.php on line nn
I have double checked that the files haven't mysteriously vanished and I've checked that the permissions are correct. In fact, the files are also used by our web application so if they weren't there our whole web application would fail.
As I said, I haven't changed anything, but suddenly PHP scripts running via cron can't find files that are there and have been used for years.
I'm wondering if a PHP update has altered the way crons look for files.
In particular, what has "include_path='.:/opt/cpanel/ea-php82/root/usr/share/pear'" got to do with anything, that's not a path we use in our code.
-
Hey there! Can you let me know the exact line of code that you have inside the crontab? That's likely the best place to start.
0 -
There are about 30 of them, but the format is -
/usr/bin/php /home/xxx/public_html/xxx/xxx.php >/dev/null 2>&1
0 -
That's likely the issue - you may need to call the specific PHP version for the account using this path instead, adjusting this for your specific PHP version:
/opt/cpanel/ea-php##/root/usr/bin/php
0 -
Thanks, I'll give that a go
1 -
Let me know what you find!
0 -
That seems to have done the trick. Thank you.
But what I don't understand is why would it suddenly be the case that I have to use that path? We've been using the same version of PHP for nearly a year now.
0 -
Did you server possibly make an update, or are you using MultIPHP with CloudLinux? I don't have a great explanation for why the sudden change may have happened as I'd really just be guessing.
0 -
Maybe there was an update, we don't use CloudLinux.
0 -
If you'd like to create a ticket we could take a more in-depth look at the system, as I wouldn't expect any update to change how this was handled. I also don't have any other reports of a similar issue today (and my own PHP crons are working normally)
0 -
We have to do a complete re-build soon due the Centos EOL. So it's not worth pursuing at this point.
1 -
We have a new server that's just a few months old and this has happened again. It seems to have occurred when I ran a manual update last week.
We're still using the path /opt/cpanel/ea-php83/root/usr/bin/php in the cron job and this is still valid but I notice the last updated date of opt/cpanel/ea-php83/root/usr/bin/php is Oct 31 04:39 which would have been when the last update occurred.
0 -
Ever since the last update something weird has happened when PHP is run from the command line that is different from when PHP runs normally.
0 -
Support Ticket 95394135
0 -
Thanks for submitting that ticket - it turns out that user was using jailshell and didn't have access to the directory the cron was running from, but we were able to get that resolved for you!
0 -
Yes. Thank you.
I've made a note of that for the future.
0
Please sign in to leave a comment.
Comments
15 comments