Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.