Re: running python in php timeout

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

 



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

-- 
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