Re: Best way to start a CRON

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, April 20, 2006 4:03 am, Barry wrote:
> What would be the best way to start a PHP Script via CRONJOB?
> Should i use the 'php' command or use curl or lynx or something to
> open that URL?

Ideally just use CLI PHP.

Slightly sub-optimal is CGI PHP with -q argument.

Also use FULL PATH to the php binary, and to your script, because the
cronjob may not (or may) be using the same "home" directory as you
are.

With a full path, you can't go wrong.

Using curl or lynx will just waste an HTTP connection for no real reason.

If, however, you need to run a cronjob on machine A, but have no shell
access on A, and have shell access on B...

Running a cron job on B to lynx to a page on A is a solution...

Not a pretty solution.

Probably not the best solution.

Maybe not even a GOOD solution.

Just A solution.

PS
You can also use -d and -c and other fun arguments to the CLI/CGI php
binary to provide a specialized php.ini file or some over-rides to
php.ini parameters.  Very handy.  Again, use FULL PATH to be safe.

> The Script does a MySQL query, collects data and sends it via E-Mail
> every monday morning to the recipient.

cron doesn't much care what your script does. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux