Re: [PHP] running python in php timeout
- From: larstorben@xxxxxxxxx ("Lars Torben Wilson")
- Date: Mon, 29 Dec 2008 17:52:34 -0800
2008/12/29 brad <bradcausey@xxxxxxxxx>:
Hi,
I'm executing a python script from php that runs quite a long time (15+
minutes) and ends up timing out. Is there a way I can execute the python
code and move on executing the remaining php code on the page?
Thanks!
Hi Brad,
It's a little tough to say for sure since you didn't specify your OS
or platform (always good info to include), but if you're on *nix then
you'll need to tell the child process to run in the background and
redirect the output from the child process to somewhere else (say, a
log file). You also didn't say how you're executing the child process,
but here's a common way to do it using backticks:
`/path/to/executable "$arg1" "$arg2" >> /path/to/logfile.log 2>&1 &`
The '>> /path/to/logfile.log' redirects standard output from the
process to your log file. The '2>&1' following that redirects the
process's standard error to its standard output (which means that
error messages will also be written to the log file), and the final
ampersand puts the child process into the background.
The same technique also works with exec() etc.
Torben
.
- References:
- running python in php timeout
- From: brad
- running python in php timeout
- Prev by Date: Re: [PHP] Architecture patterns in PHP
- Next by Date: Problem with getimagesize() in IE
- Previous by thread: running python in php timeout
- Next by thread: Problem with getimagesize() in IE
- Index(es):
Relevant Pages
|