php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8248 system function cannot support "&"
Submitted: 2000-12-14 03:50 UTC Modified: 2001-04-28 09:30 UTC
From: erwinba at 163 dot net Assigned:
Status: Closed Package: Program Execution
PHP Version: 4.0.3 OS: Linux
Private report: No CVE-ID: None
 [2000-12-14 03:50 UTC] erwinba at 163 dot net
the "system", "exec" or "passthru" function cannot support
the background process, such as :
system("/mycommand/myprog &");

The functions will not continue untill "/mycommand/myprog"
is finished, but I wish the PHP can return at once to continue after the myprog is started not ended.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-01 15:21 UTC] elixer@php.net
Have you tried disabling safe_mode?  The command will not be stripped of "questionable" characters if safe_mode is disabled.

Sean
 [2001-04-28 09:30 UTC] elixer@php.net
This is not a bug.  From the manual (http://www.php.net/manual/en/function.exec.php):

"Note also that if you start a program using this function and want to leave it running in the background, you have to make sure that the output of that program is redirected to a file or some other output stream or else PHP will hang until the execution of the program ends."

Try changing your code from:

system("/mycommand/myprog &");

to:

system("/mycommand/myprog > /dev/null &");

Sean
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 16:01:25 2019 UTC