note 112092 added to function.pcntl-exec
| From: | maxime at diametrick dot com | Date: | Thu, 02 May 2013 06:20:23 +0000 |
| Subject: | note 112092 added to function.pcntl-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194684@lists.php.net to get a copy of this message | ||
An alternative for Windows environment is to use the COM object. With this, you can start child
process with Apache, or php.exe as parent process. Very useful for CLI or console PHC-Win
applications.
if(!function_exists('pcntl_exec')){
function pcntl_exec($path,$args=array()){
if(is_string($args)) $args = array($args);
if(count($args)) $path = '"'.$path.'"';
$shell = new COM('WScript.Shell');
$shell->run($path.(count($args) ? ' '.implode(' ',$args) :
''),0,true);
}
}
Very useful too when you want to use ansicon. Instead of make a .bat file with ansicon -p and php
.... (somefile).php, in your .php file you can put this on top of your code:
pcntl_exec('ansicon -p');
BINGO!
----
Server IP: 69.147.83.199
Probable Submitter: 216.252.73.136
----
Manual Page -- http://php.net/manual/en/function.pcntl-exec.php
Edit -- https://master.php.net/note/edit/112092
Del: integrated -- https://master.php.net/note/delete/112092/integrated
Del: useless -- https://master.php.net/note/delete/112092/useless
Del: bad code -- https://master.php.net/note/delete/112092/bad+code
Del: spam -- https://master.php.net/note/delete/112092/spam
Del: non-english -- https://master.php.net/note/delete/112092/non-english
Del: in docs -- https://master.php.net/note/delete/112092/in+docs
Del: other reasons-- https://master.php.net/note/delete/112092
Reject -- https://master.php.net/note/reject/112092
Search -- https://master.php.net/manage/user-notes.php