|
Posted by C. on 07/19/07 12:24
On 18 Jul, 00:09, gordonb.h6...@burditt.org (Gordon Burditt) wrote:
> >I have to develop a script to be run nightly to go through a database
> >and send emails based on conditions. It's a large database, and there
> >are several thousands of emails to be sent during the week everyday.
> >The script will be run with a cron job at midnight or so.
>
> >I was wondering if PHP is suitable for this, or may it be problematic,
> >for instance would its execution abort after a certain amount of time?
> >Or is it perfectly fine for this task?
>
> You may want command-line PHP for this task. The interface is a
> little different (e.g. no $_GET and $_POST) but you can set different
> parameters and I believe the run time limit defaults to infinite.
> Anyway, the parameters can be put in a different .ini file and set
> differently than for web-based PHP.
You can set the time limit at run time. Also, while using the CLI PHP
(which cames as standard with the SAPI module in most Linux distros)
is the prefered option, you can invoke a web page using the wget
command (or curl) - but, in addition to to getting your webserver to
maintain a very long connection, you would need to expose the relevant
script via the web interface.
To run the php script from the command line...
php -q /some/where/mysrcipt.php
or insert the path to the command processor as the first line of your
script and make it executable:
#!/usr/bin/php5
<php>
.....
chmod ug+x /some/where/mysrcipt.php
C.
[Back to original message]
|