note 102342 deleted from function.exec by cmb
| From: | cmb@php.net | Date: | Sun, 24 Nov 2019 08:57:02 +0000 |
| Subject: | note 102342 deleted from function.exec by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213223@lists.php.net to get a copy of this message | ||
Note Submitter: bmellink at hotmail dot com
----
When calling exec() from within an apache php script, make sure to take care of stdout, stderr and
stdin (as in the example below). If you forget this and your shell command produces output the sh
and apache deamons may never return (they will normally time out after a few minutes). From the
calling web page the script may seem to not return any data.
If you want to start a php process that continues to run independently from apache (with a different
parent pid) use nohub. Example:
exec('nohup php process.php > process.out 2> process.err < /dev/null &');