When I run a PHP script using a cronjob, a require() function halts the script without returning an error, but when I run the script directly, it executes without issue.
I'm using an absolute path to my include file: require('/home/userdir/public_html/path/to/file');
This is on a GoDaddy Deluxe Linux Hosting with cPanel plan. I'm running PHP v7.3. Error reporting is on.
I'm about out of ideas, so any others are greatly appreciated!
I'm using an absolute path to my include file: require('/home/userdir/public_html/path/to/file');
- I've compared get_include_path() and it returns the same location whether I'm running from cronjob or the script directly.
- I've tried using set_include_path to set the include path to the directory containing the file to include, but that hasn't worked.
- I've also tried using chdir() as some other threads suggest, but this hasn't worked either.
- I've tried using include() instead of require() in order to trigger a warning, but this produces the same problem.
- I've checked crontab to ensure that the conjob is being run by the same owner/group as the script and include file, but again, no errors being reported.
- I've used file_exists() to ensure that the include file I'm trying to require exists at the $abspath I'm providing to the function.
This is on a GoDaddy Deluxe Linux Hosting with cPanel plan. I'm running PHP v7.3. Error reporting is on.
I'm about out of ideas, so any others are greatly appreciated!