Posted by Daniel Tryba on 11/11/59 11:19
Good Man <heyho@letsgo.com> wrote:
[snip]
> exec("my php script that emails people");
> echo "complete!";
>
> ...does not echo "complete!" until the thousands of people have all had
> their info passed to the mail server (a long time).
[snip]
> Does anyone have any thoughts as to how I can send the emails without
> preventing the administrator from doing other tasks until the script has
> finished executing?
[snip]
You need to fork and background that process (see
http://nl2.php.net/manual/en/function.pcntl-fork.php or simply append a
'&' to the program/script you exec (making sure _any_ output is
redirected to eg /dev/null)).
Better yet would be to create a que mechanism, add email and body to a
database and have a script periodically check if there are entries to be
sent. That way there is only 1 process trying to spam^Wsend email you
have to look after.
Navigation:
[Reply to this message]
|