Using phpmailer with cron job

software development

#1

I am using PHPMailer_v5.0.2 with php/5 and mysql/5.

When I run my cron job and it it encounters the line

require_once(‘PHPMailer_v5.0.2/class.phpmailer.php’);
(note: full path is actually used, and the file is found).

I get the error message:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/.mish/…/PHPMailer_v5.0.2/class.phpmailer.php on line 53

… which is the first line of code in that file

I have other cron jobs that run using the same path to php ( it is /usr/local/bin/php), so I know it is ok.

If i run my cron job manually from the browser it runs fine.

But what must happen for phpmailer to be able to run with a cron job?

Thanks,

Mike


#2

[quote]Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/.mish/…/PHPMailer_v5.0.2/class.phpmailer.php on line 53

… which is the first line of code in that file

I have other cron jobs that run using the same path to php ( it is /usr/local/bin/php), so I know it is ok.[/quote]
PHP 4.4.9 cli= /usr/local/bin/php
PHP 5.2.6 cli = /usr/local/php5/bin/php

Parse error, unexpected tokens (eg T_STRING) means that PHP couldn’t understand the source code. Uh, either the PHP source has a mistake (unlikely unless you modified it) or you are using a version of PHP that doesn’t support new syntax features.

Customer since 2000 :cool: openvein.org


#3

You are a dream.

Thanks,

Mike