Re: Startinga shell process with a life of its own

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, July 6, 2006 9:29 pm, John Gunther wrote:
> Which PHP method allows me to start a shell process from a web page
> script and let it proceed to its conclusion even though I end the
> page.
> Most of the various execute functions seem to wait for the process to
> finish before PHP continues. I don't understand the ones with
> open/close
> functions. Will opening a process and failing to close it let it run
> after the page ends? Will failing to close cause other problems? Can
> you
> point me to example code? The shell commands I want to run are
> typically
> themselves PHP programs whose execution time is far too long to
> complete
> in a browser context.

On some machines, on some OSes, in some configurations, with some
commands, tacking "&" onto the end of what you exec, will sometimes
"work"...

I would recommend, however, that you re-structure things slightly so
that the Architecture is more like this:

User visits web page.
Page generates a database record of what needs to be done.
Page finished.


CRON JOB:
Look in task list of what needs doing, and do some of them.
Make sure only one job is done at a time, or whatever race conditions
are handled here.

I've done projects both ways, and always end up frustrated with the
"PHP attempts to background a process" and the "Task List + Cron"
always works out far far better.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux