Link to home
Start Free TrialLog in
Avatar of tzun
tzun

asked on

forking a php process to background

The problem up front: I want to send quite a number of emails via php.
Sending all at mails at once is unfortunately a no-go because this
would saturate the bandwith of my host, which means i have to send
them in batches of 30 or so, and introduce waitstates in between.

Drawback here is that the script would exceed the maximum excecution
time as set in php.conf and would be terminated unfinished.

This means, I am looking for a way to fork a script to "background"
and disable any maximum execution time set. I do know that i could
write some code in another language (perl, c, etc), but if it is in any
way possible, I want to avoid that.

Avatar of sweatje
sweatje

There was a whole thread similar to your questions here.

http://zend.experts-exchange.com/jsp/qShow.jsp?qid=20144132

It basically amounts to two things:

If you have PHP installed for CGI operation, you can use
exec('php -q mailscript.php &');

otherwise you need to fetch the script with something like curl or wget in an exec
ASKER CERTIFIED SOLUTION
Avatar of us111
us111
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:

1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.

2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

3.  Ask Community Support to help split points between participating experts.  Just comment here with details.

4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  We also request that you review any other open questions you might have and update/close them.  Display all your question history from your Member Profile to view details.

PLEASE DO NOT AWARD THE POINTS TO ME.

____________________________________________



Hi Experts:

In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.

Experts, please do not add further "answer" information to this question.  I will be back in about one week to finalize this question.

Thank you everyone.

Moondancer :)
Community Support Moderator @ Experts Exchange

P.S.  REGARDING POINTS, Guidelines and more:  https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp