Re: [PHP] Triggering a PHP Script

2002-12-02 Thread Ryan Bates
Don't worry. The newsletter is only sent to those who have requested it 
in their registration, and the user can easily unsubscribe at any time.

Anyway, it looks like I will have to go with a CGI Script. Thanks for 
your reply. If anyone has any alternative methods please let me know.

Ryan Bates



On Monday, December 2, 2002, at 09:37  AM, DL Neil wrote:

Ryan,


My Problem:
I've got a PHP script (running on Apache) that can take several hours
to complete. The script sends out a newsletter to those who have
requested it. When calling this script from a web browser, the browser
hangs until the script has fully executed. If the user hits "Stop"
while the script is running, it will terminate the script.

My Questions:
What is the best way to trigger this script? Is there a way to do it
without using a CGI script? I am basically wondering if there is a way
to create a "trigger this php page" script that will run the script on
Apache and not hang the browser. Also, are there any problems calling
MySQL from a PHP CGI script?



First: trust that you are only sending to opted-in clients!?
(we're kind of sensitive about spammers around here!)

The manual is your friend: Chapter 23. Using PHP from the command 
line. Add
code to prevent PHP from timing-out (see another current thread) and 
that
takes care of your program. It will now run, outside the browser, in 
the
background, and you/your user can carry on using the browser...

As far as "trigger" goes, you can type the command into the command 
line, or
run some sort of 'job', or set it up to run off a scheduler, eg CRON or
AT/Scheduled Tasks.

Regards,
=dn



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




Re: [PHP] Triggering a PHP Script

2002-12-02 Thread DL Neil
Ryan,

> My Problem:
> I've got a PHP script (running on Apache) that can take several hours
> to complete. The script sends out a newsletter to those who have
> requested it. When calling this script from a web browser, the browser
> hangs until the script has fully executed. If the user hits "Stop"
> while the script is running, it will terminate the script.
>
> My Questions:
> What is the best way to trigger this script? Is there a way to do it
> without using a CGI script? I am basically wondering if there is a way
> to create a "trigger this php page" script that will run the script on
> Apache and not hang the browser. Also, are there any problems calling
> MySQL from a PHP CGI script?


First: trust that you are only sending to opted-in clients!?
(we're kind of sensitive about spammers around here!)

The manual is your friend: Chapter 23. Using PHP from the command line. Add
code to prevent PHP from timing-out (see another current thread) and that
takes care of your program. It will now run, outside the browser, in the
background, and you/your user can carry on using the browser...

As far as "trigger" goes, you can type the command into the command line, or
run some sort of 'job', or set it up to run off a scheduler, eg CRON or
AT/Scheduled Tasks.

Regards,
=dn


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