PHP在centos系统 视频截取第一帧
第一步 需要安装ffmpeg
参考网站:https://www.cnblogs.com/GodBug/p/7690767.html
安装EPEL Release,因为安装需要使用其他的repo源,所以需要EPEL支持:
yum install -y epel-release
#如果出现缺少Code提示,可以:
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
#安装完成之后,可以查看是否安装成功
yum repolist
安装Nux-Dextop源
#导入一个Code
sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
#安装nux-dextop 源
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
#查看repo源是否安装成功
yum repolist
yum安装ffmpeg:
yum install -y ffmpeg
安装完成后检查ffmpeg 版本:
ffmpeg -version
第二步 安装ffmpeg-php 扩展插件
参考网站: http://blog.sina.com.cn/s/blog_8818439b0102w0si.html
wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz
tar xzvf yasm-0.7.0.tar.gz
cd yasm-0.7.0 ./configure
make make install
第三步 修改 exec()配置
参考网站: https://www.qiansw.com/warning-exec-has-been-disabled-for-security-reasons-in.html
警告: /var/www/wwwroot/name.php 第二行 的exec() 函数已经由于安全原因被禁止。
这是因为在 php.ini 配置文件里面有disable_function 这个选项 后面是禁用的php函数,打开PHP.INI,找到disable_function=phpinfo,passthru,exec,system,popen,escapeshellcmd,escapeshellarg,shell_exec
解决方法:
打开php安装路径 打开php.ini文件
则把disable_function=phpinfo,passthru,exec,system,popen,escapeshellcmd,escapeshellarg,shell_exec
里面的 exec, 删除 并保存 重启php-fcgi
我使用的是lnmp一键安装包,只要/root/lnmp reload即可。