Page 1 of 1
cron job
Posted: Sat Aug 16, 2003 5:27 am
by superman
how to set up a cron job that work with PHP? is it very complicated?
is it can run a PHP file in a specific time?
what do i need? or any tutorial that teach about this?
Posted: Sat Aug 16, 2003 5:47 am
by tylerdurden
2 ways:
If you have the CLI version of PHP installed you can simply call the script with
If you don't have CLI PHP you could install a cronjob that uses wget or curl to call the script on the webserver.
Posted: Sun Aug 17, 2003 2:55 am
by superman
if my php is not a CLI version, what is the first thing that i need to do?
or create cronjob?
Posted: Sun Aug 17, 2003 3:46 am
by BDKR
Just some FYI. You can run a cron job with either a CLI or CGI install. I've been running php based jobs for two years now on machines with CGI installations . At the top of the script, you will need a line like the one below telling the system where the php executable is.
#!/usr/local/bin/php -q
#!/usr/local/bin/php (If you have a CLI install)
You will also need to understand the crontab commands. Just do a man crontab from the command line to get information on how to do it.
There are also a number of tutorials on creating cron files that can be found on google.
Lastly, I'm assuming you are on a Linux/Unix type system. If you are on Windows, there are options, but you have to find them on google. I've explored them, but it's been a while and I don't remember where they are.
Cheers,
BDKR
Posted: Sun Aug 17, 2003 4:10 am
by sguy
is it need to type someting in linux command line?
Posted: Sun Aug 17, 2003 4:17 am
by superman
how can i know the CLI or CGI installed on my machine?
Posted: Sun Aug 17, 2003 1:56 pm
by qartis
In Windows,
C:\PHP\> php.exe php_file.php
On Unix:
[root@localhost /]# php php.file.php
(Assuming `php` is in your $PATH)
Posted: Mon Aug 18, 2003 4:52 am
by superman
is it just type #!/usr/local/bin/php on the page that need to run?
need to configure something in linux server or type in some command line?
Posted: Mon Aug 25, 2003 8:03 am
by superman
i put all the PHP file inside this directory
http://10.1.1.200/B0300549/public_html/phpweb/cron.php
the
cron.php is the page that i need to run
if i want to run the
cron.php once a year (every January), is it the correct way that i wrote?
crontab -e
* * * 1 * php /10.1.1.200/B0300549/public_html/phpweb/cron.php
then, am i need to put this line on top of the
cron.php
#!/10.1.1.200/B0300549/public_html/phpweb/php