Home >Backend Development >PHP Tutorial >exec(), passthru()-there is a problem when calling system commands

exec(), passthru()-there is a problem when calling system commands

WBOY
WBOYOriginal
2016-08-29 08:50:481026browse

The php file calls system commands. If you execute the php file directly in the terminal, it can be executed. However, there is no response when accessing the file in the web server. What is the problem? Permissions issue? then what. . .

Reply content:

The php file calls system commands. If you execute the php file directly in the terminal, it can be executed. However, there is no response when accessing the file in the web server. What is the problem? Permissions issue? then what. . .

It should be a permissions issue

I encountered a similar problem just now. You said you can't execute the ffmpeg command, right? I can't execute the command to generate pictures.
We are all successful in executing it directly from the command line, but calling it in php is not possible, right? And ordinary commands can succeed.
I think what our problems have in common is that we all need to generate files.
My situation is that I created a new directory in the apache default web directory and placed the php file in it, but I did not grant write permission to this directory. I only gave permission to the php file inside, and then I couldn't find it. to the reason.
I just tried to give write permission to the entire directory and it worked.
I don’t know if you have a similar situation. If not, it may be a configuration problem with php.ini, such as safe_mode=off not being configured.
Hope it helps you~

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