I am trying to run a php file via cron job, the file works fine when I run it manually, but when I run it in a cron job, I get this error:
Warning: include(classes/EmailAddressValidator.php): failed to open stream: No such file or directory in /var/www/onecent_dev/classes/MiscFunctions.php on line 3
Warning: include(): Failed opening 'classes/EmailAddressValidator.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/onecent_dev/classes/MiscFunctions.php on line 3
MiscFunctions.php & EmailAddressValidator.php are both existing files and are in the right place, what gives?
Thanks
Looks like your include_path is resolving . to whatever cron happens to have the current directory set to, as opposed to the directory where your script is. Try editing your crontab to cd first:
Or provide the include_path explicitly: