cron and php

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
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

cron and php

Post by nikko50 »

Hello there. I can't seem to get this crontab to run my cron.php page which is is a simple db query. Here is the code for the crontab entry

27 * * * * /homepages/29/test/htdocs/cron.php >/dev/null

Does this look good to you. Any suggestions???
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

You should be passing it through php first (or using a CGI version of PHP in your script).

It's location will vary depending on your server. But pass the "php.exe" (on Windows) your path + file.
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

Post by nikko50 »

Thanks for the reply. Can I find my web server PHP executable location with phpinfo()?? Also can I find my root dir with phpinfo()??
Tracy:)
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

Root DIR yes definitely - php exe location I'm afraid not, sorry. Do you have telnet/ssh access to your server?
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

Post by nikko50 »

Hi Rich. Yes I do. I'm in there right now.
Tracy
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

If it is a Unix server try this:

where php

for me it is in: /usr/local/bin/php

You can pass your PHP scrript directly to that.
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

Post by nikko50 »

tried that and get bad command.
Tracy:(
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

Is it a Unix server? If so you could try "locate php" too - or just see if the following work:

/usr/local/bin/php
/usr/bin/php

Remember you must pass it the full path to your script (once you locate it!)
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

Post by nikko50 »

Works great now. Hugs for you!!
Cheers,
Tracy
Post Reply