Welcome to WebmasterWorld Guest from 54.163.23.73

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Cron Job to execute PHP script?

How to do it on unix?

     

hbirnbaum

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

10+ Year Member



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?

jamie

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

WebmasterWorld Senior Member 10+ Year Member



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

dmorison

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

WebmasterWorld Senior Member 10+ Year Member



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.

Slade

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

10+ Year Member



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.

dreamcatcher

1:32 am on Dec 15, 2004 (gmt 0)

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



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

hbirnbaum

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

10+ Year Member



Thanks guys! I appreciate all the info...