RE: [PHP] Can php auto execute it's script in schedule without opening a webpage?

2002-12-16 Thread John W. Holmes
 Dear all
 I just wonder did anyone know if php can act as a scheduler rather
than
 execute script manually?
 i want to set a schedule for php to run certain script at specify
time, to
 what i understood in php is : the script can only be process when a
 homepage
 had been execute. but i want the script to be excute even no one open
a
 homepage contain php script in it!

Sure. Write the PHP script you want to use. There shouldn't be any
output from the script or it should all go to a database or file, since
no one will be executing it to see it. 

Use cron on a *nix server to schedule when you want it to run. You
should have a standalone version of PHP installed somewhere and you can
just do php -q filename.php as what you want to run. You can also run it
through lynx or wget if you don't have a standalone version of PHP
available. Lynx --dump http://yourdomain/file.php. 

If you're on Windows, you can use task scheduler to run the program
through php.exe like php.exe -q c:\path\to\file.php. Or you can load it
up through Internet Explorer, iexplore.exe http://youdomain/file.php. If
you use IE, there is a checkbox in the Task Scheduler program that will
end the program after X minutes. Check that to have it shut down IE
after a couple minutes, you PHP script should be done executing by then.


Hope that helps. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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




Re: [PHP] Can php auto execute it's script in schedule without opening a webpage?

2002-12-15 Thread Chris Shiflett
--- Jack [EMAIL PROTECTED] wrote:
 i want to set a schedule for php to run certain
 script at specify time, to what i understood in
 php is : the script can only be process when a
 homepage had been execute. but i want the script
 to be excute even no one open a homepage contain
 php script in it!
 
 is there anyway i can do that?

Sure, though it varies depending on your platform.

Assuming you are on Unix, it is likely that you already
have a CLI (command line interface) PHP installed
somewhere. You can use this to create a PHP script that can
be executed like any other shell script. Just put something
like this at the top:

#! /usr/bin/php -q

Be sure it points to the location of your PHP parser
(/usr/bin/php in this example).

To automate scripts, look into cron:

man cron
man crontab

Good luck.

Chris

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