Home > Article > Backend Development > What should I do if php system does not execute?
Solution to the problem that php system does not execute: 1. Remove the system after the disable_functions equal sign; 2. Add the running account permissions of the current site; 3. Change the access path of the file to a relative path, and change IECapt Just copy the .exe to the current directory of the site program.
The operating environment of this article: Windows 7 system, PHP version 7.1, Dell G3 computer.
What should I do if php system does not execute? How to solve the problem that PHP cannot execute the system() function?
Problem Description
Why is PHP unable to execute the system() function?
Answer
PHP cannot execute the system() function. There may be the following situations:
(1) Warning: system() has been disabled for security reasons
This error is due to the server security configuration turning off the system function. Open the php.ini file and remove the system after the disable_functions equal sign.
(2)Warning: system() [function.system]: Unable to fork
This error is due to the current site’s running account being unable to access cmd.exe and finding Windows\system32\cmd .exe attribute, just add the running account permissions of the current site or the users group permissions.
(3) There is no response or error when executed under Web access, but the result can be returned normally when executed using the php cli command line. This error is generally caused by the Windows system path. The program may use Use the absolute path to access the program, for example:
system('D:\server\DLL\IECapt.exe --url=http://tech.cncms.com --out="D:\web\tt.fei.cn\htdocs\ttt\tech.png"');
At this time, the command line execution result is correct, but the Web access will return a blank page without errors.
Modification method: Change the access path of the file to a relative path, copy IECapt.exe to the current directory of the site program, and change the code to:
system('IECapt.exe --url=http://www.baidu.com --out=t/tech.png');
3 Visit the page again, You can output normally.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What should I do if php system does not execute?. For more information, please follow other related articles on the PHP Chinese website!