Home  >  Article  >  Backend Development  >  php function cannot be used

php function cannot be used

藏色散人
藏色散人Original
2019-10-30 09:46:103140browse

php function cannot be used

php function cannot be used?

Problem Description

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

Question 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.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of php function cannot be used. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Is php or js better?Next article:Is php or js better?