On centos7, what if PHP's shell_exec () doesn't execute the command?

I use the command
ffmpeg-I / home/video/a.mp4-r 1-s 950x520-f image2 / home/video/a.jpg
can be executed on the terminal,
but in the PHP file, using shell_exec ("ffmpeg-I / home/video/a.mp4-r 1-s 950x520-f image2 / home/video/a.jpg") is not successful.
Baidu on the Internet said it was a permission problem, so it was tested

.

echo shell_exec ("ls") can execute
echo shell_exec (" whoami") to display nginx

so vim / etc/sudoers adds

< H2 > Allow root to run any commands anywhere < / H2 >

root ALL= (ALL) ALL
nginx ALL= (ALL) ALL

after saving, reboot restarts but it doesn"t work.

should I add nginx to the root user group?

Oct.17,2021

write the command in the sh script, and running the script should work.


what does the php running script have to do with nginx? You should see the permissions of php-fpm


sudo.


1. If your command requires super permission, make sure that the user who executes php-fpm has sudo permission and sudo
2 before the command. A terminal environment is required by default to execute the sudo command. If you want to remove this constraint, Comment out the line Defaults requiretty under the / etc/sudoers file
3. Execute the command in php. You can print out the result of the execution to see the error message and error code to analyze


1. Permissions (including php executable methods)
2. Program path
3. You can redirect logs and errors to a file

follow and you should be able to find the problem.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9b0fc-182b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9b0fc-182b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?