Setting up a cron job in phpMyAdmin

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Setting up a cron job in phpMyAdmin

Post by aceconcepts »

Hi,

I've setup a cron jobwhich is intended to execute a php script.

I get the following message emailed to me when the job is run:

line 1: ?: No such file or directory
line 2: syntax error near unexpected token `"localhost",'
line 2: `$dbh=mysql_connect ("localhost", "uname", "pword") or die ('I cannot connect to the database because: ' . mysql_error());'

The script is supposed to insert some data into a table.

Any ideas?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Yes. You probably have only entered the path of the script into the crontab program. It needs two parts:

Code: Select all

/path/to/php /path/to/script
So, a sample crontab command would be:

Code: Select all

/usr/bin/php /home/scott/cron/myscript.php
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post by aceconcepts »

Oh I see. I will give it a go.

Thanks.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post by aceconcepts »

Hi,

I included the php path and now I get this message:

Status: 404
X-Powered-By: PHP/4.4.4
Content-type: text/html

No input file specified.

Does this mean that I have entered an incorrect file path?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Yes
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post by aceconcepts »

Thanks for confirming.

It's all working now.

Thank for your help.
Post Reply