Crons Suddenly Can't include PHP files
For 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
Please sign in to leave a comment.
Comments
10 comments