The ffmpeg-phpffmpegpassthru () function can transcode the php file on the terminal, and the PHP file cannot be transcoded when accessed by the web. Why ??

Source: Internet
Author: User
Problem scenario: use ffmpeg to transcode the file. Problem Description: using php to call the terminal ffmpeg command through exec (), passthru (), system () to implement transcoding code: {code ...} running this php file on the terminal can be transcoded normally, but it can be passed... problem scenario: use ffmpeg to transcode the file.
Problem Description: use php to call the terminal ffmpeg command through exec (), passthru (), and system () to implement transcoding.
The code is as follows:

$cmd = '/usr/local/bin/ffmpeg -i test.mpg -c:v libx264 -b:v 1024k -b:a 128k -ar 16000 fina6555555431l.mp4';echo shell_exec('whoami');passthru($cmd,$res);var_dump('zhuangtai'.$res); 

Running this php file on the terminal can be transcoded normally.
However, access to this file through the web cannot be transcoded. Why ??
I didn't write the full path of ffmpeg before. the passthru () status code cannot find the command. now, access in the web returns 1, indicating that the execution was not successful.
Directly execute the php file in. is the status 0? the execution is successful.
Does ffmpeg have problems with user permissions?
The user printed on the web is www-data.
The terminal is root.

I have never done it. what is the reason for this situation ....
. Urgent...
The younger brother is engaged in mobile development. he is not familiar with this. he has a lot of Google himself and has not found the reasons and solutions ----

-------!!!!!!!!!!!!!

Reply content:

Problem scenario: use ffmpeg to transcode the file.
Problem Description: use php to call the terminal ffmpeg command through exec (), passthru (), and system () to implement transcoding.
The code is as follows:

$cmd = '/usr/local/bin/ffmpeg -i test.mpg -c:v libx264 -b:v 1024k -b:a 128k -ar 16000 fina6555555431l.mp4';echo shell_exec('whoami');passthru($cmd,$res);var_dump('zhuangtai'.$res); 

Running this php file on the terminal can be transcoded normally.
However, access to this file through the web cannot be transcoded. Why ??
I didn't write the full path of ffmpeg before. the passthru () status code cannot find the command. now, access in the web returns 1, indicating that the execution was not successful.
Directly execute the php file in. is the status 0? the execution is successful.
Does ffmpeg have problems with user permissions?
The user printed on the web is www-data.
The terminal is root.

I have never done it. what is the reason for this situation ....
. Urgent...
The younger brother is engaged in mobile development. he is not familiar with this. he has a lot of Google himself and has not found the reasons and solutions ----

-------!!!!!!!!!!!!!

You are using the root user on the terminal. This user has no permissions, but the user permissions on the web are limited ~.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.