I have a php mailer script that needs to run every hour via cron job. Basically it collects information from a database attaches this in the phpmailer via html and sends it out.
Via the web service if i browse to the mailer it runs perfectly and i receive the mail. However when doing this via cron the mail does not send out.
I have currently set the cron to run every 5 minutes just to test and touch a tmp file just to know it has run:
*/5 * * * * /var/www/Mailer/311-daily-production-3shifts-mailer.php; touch /tmp/mailerhasrun
anyone know what the issue can be? i am logged in via the root user on my pi.
EDIT
If i now run the script directly from the command line i get the following error, however it is still working from the web service
root@raspberrypi:~# php /var/www/Mailer/311-daily-production-3shifts-mailer.php
PHP Warning: include(./scripts/311-daily-production-3shifts.php): failed to open stream: No such file or directory in /var/www/Mailer/311-daily-production-3shifts-mailer.php on line 10
PHP Warning: include(): Failed opening './scripts/311-daily-production-3shifts.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/Mailer/311-daily-production-3shifts-mailer.php on line 10
PHP Warning: require(./library/PHPMailerAutoload.php): failed to open stream: No such file or directory in /var/www/Mailer/311-daily-production-3shifts-mailer.php on line 14
PHP Fatal error: require(): Failed opening required './library/PHPMailerAutoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/Mailer/311-daily-production-3shifts-mailer.php on line 14
EDIT:
I have fixed my php errors and when i run /usr/bin/php /var/www/Mailer/311-daily-production-3shifts-mailer.php
from command line it sends the mail as required. However the cron is still not working.