shell_exec without waiting for the output
This has been answered before at Asynchronous shell exec in PHP
Briefly:
shell_exec( $your_command . "> /dev/null 2>/dev/null &" );
Is there a way to use shell_exec without waiting for the command to complete?
How about adding.
"> /dev/null 2>/dev/null &"
shell_exec('php measurePerformance.php 47 844 email@yahoo.com > /dev/null 2>/dev/null &');
Note this also gets rid of the stdio and stderr.
shell_exec without waiting for the output
This has been answered before at Asynchronous shell exec in PHP
Briefly:
shell_exec( $your_command . "> /dev/null 2>/dev/null &" );
PHP execute command and log output without waiting
On Linux you can do:
exec('command* > /dev/null 2>/dev/null &');
On Windows you can do:
pclose(popen('start /B cmd /C "command* >NUL 2>NUL"', 'r'));
Both examples disable output and errors, those go to /dev/null
(linux) or NUL
(windows) which means they are stored "nowhere".
You can replace these with valid paths on your system.
On Linux, a &
at the end places it into background. On windows this is more complicated and needs start
to invoke the process and cmd
to allow redirection of the streams.
PHP Exec: Without Waiting, Without Discarding the Output, Without nohup
Add an ampersand to the end of the command, so:
exec('dosomething > saveit.txt &');
Is there a way to use shell_exec without waiting for the command to complete?
How about adding.
"> /dev/null 2>/dev/null &"
shell_exec('php measurePerformance.php 47 844 email@yahoo.com > /dev/null 2>/dev/null &');
Note this also gets rid of the stdio and stderr.
Execute another PHP file without waiting for it to finish its execution
This should help you - Asynchronous shell exec in PHP
Basically, you shell_exec("php Server.php > /dev/null 2>/dev/null &")
Related Topics
Correct Way to Use Like '%{$Var}%' With Prepared Statements
Why Is MySQLi Giving a "Commands Out of Sync" Error
String Comparison Using '==' Vs. 'Strcmp()'
Setting Up a Deployment/Build/Ci Cycle For PHP Projects
PHP If Statement With Multiple Conditions
PHP: Producing Relative Date/Time from Timestamps
Returning Json from PHP to JavaScript
Get Url Query String Parameters
Pdo Valid Characters For Placeholders
How to Upload Images into MySQL Database Using PHP Code
Get All Permutations of a PHP Array
Parse Youtube Video Id Using Preg_Match
PHPdoc Type Hinting For Array of Objects
PHP: Replace Umlauts With Closest 7-Bit Ascii Equivalent in an Utf-8 String
Laravel: Error [Pdoexception]: Could Not Find Driver in Postgresql