|
Posted by JDS on 03/21/06 23:36
On Tue, 21 Mar 2006 19:42:58 +0100, J.O. Aho wrote:
> Run things with help of cron.
No, you see, I want to be able to fork a process from a user-initiated
session from a web browser. Specifically, this is for a mass-emailer.
In any case, I figured out a way to do it. I didn't want to install PHP
CLI so I used Perl instead. Now I have to debug the Perl script for
securiy flaws, stability, and reduced resource use, but the durn thing
does work as intended. Quickly returns control of the web browser to the
user, even for very very long email lists. Continues to process said
mailing list in the background.
General description:
(1) Create a simple mailing script that can run from the command line and
will accept CLI arguments. Script can really be in any language, PHP,
Perl, C, Ruby, Python, whatever -- it is a separate entity from the PHP
script that interacts with the browser.
(2) Execute the CLI script using PHP's exec() function. Include ampersand
at end and direct STDOUT to /dev/null
This won't work on Windows, I'm durn sure of that. But Windows sucks
ass nuggets anyways, so who would be using Windows as a PHP-enabled web
server?
In any case, I got the inspiration from this page:
http://www.phpfreaks.com/tutorials/71/0.php
It should be noted that I do not use the PCNTL functions at all for this
task. (Side note: So I'm uninstalling them.)
And finally, I will post the entire exercise to my website if anyone
requests it. Always glad to help if I can.
word to your momma. Later...
--
JDS | jeffrey@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/
Navigation:
[Reply to this message]
|