How to install ffmpeg for PHP

隐身守侯 提交于 2019-12-17 04:07:27

问题


I've successfully installed ffmpeg using ssh, as root, on my dedicated server (CentOS 7).
ffmpeg works fine - but now I need to use it without root access.

When i try to use ffmpeg without root access, I get the following error :

ffmpeg: error while loading shared libraries: libx264.so.148: 
        cannot open shared object file: No such file or directory

The final goal is to be able to use ffmpeg inside my PHP scripts which do not root access.


回答1:


The easiest solution is to download an already compiled ffmpeg binary and point your script to it. On the FFmpeg Download page refer to the Get the packages section for links to recent static builds for Linux, Windows, and macOS.

You can use shell_exec() as shown in FFmpeg Wiki: PHP and provide the full path to the downloaded binary.




回答2:


Maybe too late, But here is a updated solution:

Install the lib in your Operating System https://www.vultr.com/docs/how-to-install-ffmpeg-on-debian-8-or-9

Install for PHP 7.x via composer https://github.com/PHP-FFMpeg/PHP-FFMpeg



来源:https://stackoverflow.com/questions/39884653/how-to-install-ffmpeg-for-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!