Jump to content

[SOLVED] Cronjob returns syntax error


The14thGOD

Recommended Posts

I have a cron job going and its finding the right file but it's emailing me back with errors. Syntax errors, but if I run it from the browser it runs fine.

 

Error:

/var/path/to/domain/httpdocs/csv_db.php: line 1: ?php

: No such file or directory

/var/path/to/domain/httpdocs/csv_db.php: line 2: syntax error near unexpected token `('

/var/path/to/domain/httpdocs/csv_db.php: line 2: ` $dbh = mysql_connect("localhost","username","password");

 

CronJob:

52 * * * * /var/path/to/domain/httpdocs/csv_db.php

 

Start of PHP:

<?php
$dbh = mysql_connect("localhost","username","password");
mysql_select_db("db");	
$date = date("Y-m-d H:i:s");?>

 

Any ideas?

Thanks in advance,

Justin

Link to comment
https://forums.phpfreaks.com/topic/180185-solved-cronjob-returns-syntax-error/
Share on other sites

nope that didnt work, i got a different error however i found this tutorial:

http://www.htmlcenter.com/blog/running-php-scripts-with-cron/

 

basically if you have Apache handling ur PHP and not CGI, you do:

 

30  *  *  *  *  http://www.example.com/cron.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.