note 99505 modified in ref.exec by danbrown
| From: | danbrown@php.net | Date: | Tue, 24 Aug 2010 13:05:45 +0000 |
| Subject: | note 99505 modified in ref.exec by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171979@lists.php.net to get a copy of this message | ||
Within Linux, when calling the php interpreter directly from popen, or other program execution
function to execute a script, it appears as though the script perpetually fails and re-executes.
i.e. <?php popen("php myscript.php&", "w"); // fail ?>
As each re-execution causes the executing script to load under a new PID, it is incredibly difficult
to identify and kill the process manually.
[One solution is] to ensure the executing script has a valid shebang, and execute permissions. This
allows you to execute the script directly
i.e. <?php popen("./myscript.php", "w"); // ok ?>
--was--
Within Linux, when calling the php interpreter directly from popen, or other program execution
function to execute a script, it appears as though the script perpetually fails and re-executes.
i.e. popen("php myscript.php&", "w"); // fail
As each re-execution causes the executing script to load under a new PID, it is incredibly difficult
to identify and kill the process manually.
THE SOLUTION:
At http://thecodeabode.blogspot.com/
2010/08/calling-php-interpreter-within-web.html the solution proposed was to ensure the executing
script has a valid shebang, and execute permissions. This allows you to execute the script directly
i.e. popen("./myscript.php", "w"); // ok
http://php.net/manual/en/ref.exec.php