What should I do if the php system is not executed? How to solve the problem that PHP cannot be executed

Why is PHP unable to execute the system() function?


PHP cannot execute the system() function, there may be the following situations:

(1) Warning: system() has been disabled for security reasons This error is because the server security configuration has closed the system function. Open the php.ini file and remove the system after the equal sign of disable_functions.

(2) Warning: system() [function.system]: Unable to fork This error is because the running account of the current site cannot access cmd.exe. Find the attribute of Windows\system32\cmd.exe and add the running account permissions or users group permissions of the current site.

(3) There is no response and no error is reported when executed under Web access, but the result can be returned normally when executed using the php cli command line. The error is generally caused by the Windows system path, and the absolute path may be used in the program to access the program. E.g:

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 execution result of the command line is correct, but the web access will return a blank page without error.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *