note 88543 added to function.system

From: Date: Wed, 28 Jan 2009 17:11:47 +0000
Subject: note 88543 added to function.system
Groups: php.notes 
Request: Send a blank email to php-notes+get-149896@lists.php.net to get a copy of this message
I found a lot of solutions how to run app asynchronously in background, but nothig works. :( But now I have a solution. <? function runAsynchronously($path) { $WshShell = new COM("WScript.Shell"); $spustec = getcwd()."\\_".uniqid().".php"; #Generate PHP code to run app and save it into file $spoustec fwrite(($fp = fopen($spustec,"w+")),"<?php chdir(dirname(__FILE__));\$command = \"".addslashes($path)."\";echo \"Now running external program...\n\n\";system(\$command);echo \"Now deleting...\";unlink(__FILE__); ?>"); fclose($fp); # Now run $spoustec -> it will start $path $oExec = $WshShell->Run($spustec, 7, false); unset($WshShell,$oExec); } runAsynchronously("notepad"); // Will open notepad, but it will continue excuting the PHP code echo "Running :)\n\n"; sleep(1); ?> (Tested on Win7) I spend a lot of time on it. So I hope that this will help you. P.S.: Sorry for my English. ;) ---- Server IP: 147.32.160.17 Probable Submitter: 77.240.187.175 ---- Manual Page -- http://www.php.net/manual/en/function.system.php Edit -- https://master.php.net/note/edit/88543 Del: integrated -- https://master.php.net/note/delete/88543/integrated Del: useless -- https://master.php.net/note/delete/88543/useless Del: bad code -- https://master.php.net/note/delete/88543/bad+code Del: spam -- https://master.php.net/note/delete/88543/spam Del: non-english -- https://master.php.net/note/delete/88543/non-english Del: in docs -- https://master.php.net/note/delete/88543/in+docs Del: other reasons-- https://master.php.net/note/delete/88543 Reject -- https://master.php.net/note/reject/88543 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149896) next »