Welcome to WebmasterWorld Guest from 54.196.208.6

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Cron Job to execute PHP script?

How to do it on unix?

     
1:01 pm on Dec 14, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 7, 2003
posts:111
votes: 0


I have a PHP script I want to execute automatically once a month. I was thinking Chron job. But, I am not sure of the unix command to execute a script. Can it be the URL of the script I want to execite? How do I set this up in cPanel?
1:17 pm on Dec 14, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:July 24, 2002
posts:1124
votes: 0


if you have php installed as a cgi [es.php.net], then you can call it as you would another cron job.

if not then you could use lynx - try this post for more info:
[webmasterworld.com...]

re: cpanel - i don't. sorry.

p.s. if you search these forums you'll find plenty of references to php and cron.

good luck

6:17 pm on Dec 14, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 3, 2003
posts:1633
votes: 0


If you don't have the PHP cgi installed you can use wget to run a PHP script via cron.

The command is simply:

wget -O /dev/null [example.com...]

The -O /dev/null part means send the output to the null device so that no disk space is taken up with the HTML (or whatever) output from your script.

8:15 pm on Dec 14, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:July 16, 2001
posts:545
votes: 0


In the X skin for Cpanel, there is a Cron Jobs tab near the bottom of the main page of icons. I expect it is available in other skins, but it might be one level further in.
1:32 am on Dec 15, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member dreamcatcher is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 30, 2003
posts:3719
votes: 0


In cpanel the following will also work:

php -q /home/serverpath/script/file.php

Note that -q is seperated by spaces.

There are also some threads on the cpanel forum about settings up cron jobs.

dc

12:46 pm on Dec 15, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 7, 2003
posts:111
votes: 0


Thanks guys! I appreciate all the info...