Search code examples
phpcronphpmailerovh

Ovh cron error with phpmailer


I've made a php script backing up my database in some file.sql then mailing that file to a backup mail with phpmailer.

The script works fine both on localhost and on my ovh server when I run it manually.

But when it's being run on task scheduler, it doesn't do anything.

I finally found in ovh logs the error :

[2015-08-27 00:04:03] ## OVH ## START - 2015-08-27 00:04:03.481779 executing: /usr/local/bin/php.ORIG.4 -c /usr/local/lib/php.ini /homez.716/my_info_name/www/php/backup/backup.php 
[2015-08-27 00:04:03] X-Powered-By: PHP/4.4.9
[2015-08-27 00:04:03] Content-type: text/html
[2015-08-27 00:04:03] 
[2015-08-27 00:04:03] <br />
[2015-08-27 00:04:03] <b>Parse error</b>:  syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/my_server_path_to_php_mailer/phpmailer/class.phpmailer.php</b> on line <b>34</b><br />
[2015-08-27 00:04:03] 
[2015-08-27 00:04:03] ## OVH ## END - 2015-08-27 00:04:03.573742 exitcode: 255

I don't know how to fix this. I read it could be some php version issues but I'm using default php version (app.engine.version=5.4 in .ovhconfig) and last phpmailer code downloaded on github.

Thanks in advance :-)


Solution

  • Sometimes Hostings use different php version for cronjobs. Maybe you have to set it manually.

    Read this http://guides.ovh.com/MutualiseCron