Re: [PHP] How to launch a background task from a web page
- From: richard@xxxxxxx ("Richard Heyes")
- Date: Thu, 30 Oct 2008 16:46:03 +0000
I have some long running scripts which I need to launch from a web page and
have them run in the background, but which should not cause the web page to
wait until the script finishes. Reading the manual on the backtick and
exec() operators seems to imply that the PHP function will be suspended
until the script finishes, which is not what I want. Is this possible in
PHP?
You need to redirect all output (I'm assuming you're on *nix), ie
STDEOUT and STDERR. For example:
$cmd = 'sleep 5';
exec("{$cmd} > /dev/null 2>&1");
--
Richard Heyes
HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated October 25th)
.
Relevant Pages
- Where did the prophet really live?
... > under "North Arabian" is Classical Arabic and idioms that, ... explains why Old Arabic and ANA where written in the Sabaic script. ... Sabaic was the prestige script of the region. ... One doesn't need to dissociate the great reading from the prophet to ... (soc.religion.islam) - Re: No such file or directory
... Still cannot see why Perl complains that Could not open file for reading. ... I have modified my script and now using Getopt::Long module instead of the ... foreach $list { ... (perl.beginners) - RE: Trace Viewer
... no way from the current API of reading in a random acess form. ... so they are in more managable sizes (I'll attach a script to the ... | I tried to write one trace viewer using virtual list view control. ... (microsoft.public.vsnet.enterprise.tools) - Re: To Kill and English Teacher
... I used to use both Kes and Shakespeare, ... reading bits of the script. ... killed, rolled up newspaper swords, and chopping the script into one-line specials and handing them out randomly. ... By the end of a 14 week term they have a essay about character development, one about plot and sub-plot, one comparing a film version to the script as published, and one about Mr S's use of language, plenty of oral grades for the 'drama' lessons and discussions, and udually some fun bits like Wanted posters for Romeo and news reports about the deaths. ... (uk.rec.sheds) - Re: Re-opening a file
... I can't read it back until I run the script again. ... doing X between closing and re-opening the file?". ... server. ... For instance there are many ways for reading from a file. ... (comp.lang.php) |
|