我一直想安装ffmpeg作为我的PHP设置的扩展。在安装它之前,我需要phpize它。我通过sudo apt-get install php5-dev安装了php5-dev。但现在当我运行phpize时,我得到以下错误:

phpize
Cannot find config.m4. 
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module

php.ini的位置是/usr/local/zend/etc/php.ini

我从另一个在线资源上尝试了这个方法

sudo apt-get install autoconf automake libtool m4

但是它们都已经安装好了。

定位配置。M4没有返回任何东西。

这里有什么提示吗,如何让phpize和ffmpeg启动并运行?


Ohk . .我通过输入/usr/bin/phpize来运行它,而不是只输入phpize。


嗯…其实我不知道这是怎么解决的?但下面的步骤帮我解决了这个问题:

find / -name 'config.m4'

现在看看配置。M4是你想要phpize的东西的文件夹中的任何地方。找到那个文件夹,直接在里面运行phpize。


对于最新版本的Debian/Ubuntu (Debian 9+或Ubuntu 16.04+),安装php-dev依赖包,它将自动为您的发行版安装正确版本的php{x}-dev:

sudo apt install php-dev

旧版本的Debian/Ubuntu:

对于PHP 5,它在php5-dev包中。

sudo apt-get install php5-dev

对于PHP 7。X(来自rahilwazir的评论):

sudo apt-get install php7.x-dev

RHEL / CentOS /百胜

yum install php-devel # see comments

这可能会帮助ubuntu上的某些人。没有承诺。

sudo apt-get install libcurl3 php5-dev libcurl4-gnutls-dev libmagic-dev
sudo apt-get install php-http make
sudo pecl install pecl_http

并添加“extension=http.”so" to php.ini(通常位于/etc/php5/apache2/php.ini)

然后重启Apache (sudo service apache2 restart)。

如果有疑问,请检查apache日志:

sudo su --
cd /var/log/apache2
tail -25 error.log

是http。开始还是失败?


在Redhat Enterprise / CentOS目录下,使用yum安装php-devel模块:

yum install php-devel

对于PHP 7,你需要:

yum install php70-php-devel

在Ubuntu 16.04中,可以通过命令安装phpize

aptitude install php7.1-dev // for php 7.1

这相当于

apt-get install php7.1-dev // for php 7.1

PHP7用户

7.1

安装php7.1-dev

7.2

安装php7.2-dev

7.3

安装php7.3-dev

7.4

安装php7.4-dev

如果不确定您的PHP版本,只需运行PHP -v命令


对于ubuntu 14.04LTS与php 7,发布:

sudo apt-get install php-dev

然后安装:

pecl install memcache

对于安装了Plesk的ubuntu运行apt-get install Plesk -php5 -dev,对于其他版本只需在phpXX中修改XX(不带点)


从linux终端安装

sudo apt-get install <php_version>-dev

例子:

sudo apt-get install php5-dev     #For `php` version 5
sudo apt-get install php7.0-dev   #For `php` version 7.0

转到下载的文件夹,在那里您可以找到config.m4。打开终端,运行phpsize。


例如,如果你想在PHP 5.6中使用"phpize"命令,你可以使用完整的路径: 代码:

/opt/cpanel/ea-php56/root/usr/bin/phpize

当然在PHP7.2中

sudo apt-get install php7.2-dev

步骤- 1:如果你不确定安装的php版本, 然后在终端中执行如下命令

php -v

输出:上面的命令将输出安装在你机器上的php版本,我的是7.2

PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.3-1ubuntu1, Copyright (c) 1999-2018, by Zend Technologies

步骤2:然后安装phpize运行以下命令,因为我的php版本是7.2.3。我将用7.2替换它,所以命令将是,

sudo apt-get install php7.2-dev

第三步:完成!

替代方法(可选): 要根据机器上安装的php版本自动安装phpize版本,请运行以下命令。

sudo apt-get install php-dev

这个命令将自动检测安装的适当的php版本,并为其安装匹配的phpize。


2018年,我在macOS上遇到了这个问题。

对我来说,在sudo pecl install mongodb之前,首先运行brew install php就成功了。


如果你有phpize在CentOS7上找不到的问题。在你为你的PHP版本安装了相关的开发工具后,这个路径最终对我有用:

对于PHP 7.2.x

/opt/cpanel/ea-php72/root/usr/bin/phpize

对于PHP 7.3.x

/opt/cpanel/ea-php73/root/usr/bin/phpize

对于PHP 7.4.x

/opt/cpanel/ea-php74/root/usr/bin/phpize

在包含下载的PHP扩展的文件夹中运行它,例如下面的第3行:

基于安装PHP v7.3的示例。x Brotli扩展https://github.com/kjdev/php-ext-brotli

git clone --recursive --depth=1 https://github.com/kjdev/php-ext-brotli.git
cd /php-ext-brotli
/opt/cpanel/ea-php73/root/usr/bin/phpize
./configure --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config
make
make test

你没有说明你使用的是什么操作系统,90%的答案假设是Ubuntu/Debian Linux,因为你发布了apt-get install autoconf automake libtool m4命令(超过一半的人预计你会运行CPanel),所以我给你一个稍微更通用的解决方案,它应该可以在任何Un*x克隆(包括微软的WSL!)

你至少需要一些先决条件:

A working C/C++ compiler — GCC or clang being the most popular options these days. A 'developer edition' of PHP, which some package managers call 'development headers'. In the case of aptitude, as shown on the other answers, you ought to be fine with just sudo apt install php-dev. Beware of the mentioned caveats: you might end up with a slightly more unstable version of PHP which might not be updated correctly with future versions. These days (that's late 2021 for me!), for those running Ubuntu, and wishing to seriously tinker with PHP, the recommendation is to use Ondřej Surý's personal package archive for PHP. Ondřej keeps his PPA always up to date, sometimes within a few hours after release; he keeps up with the latest four Ubuntu distributions and all the currently supported PHP versions that haven't reached end-of-life status yet (sorry, PHP5 is considered completely obsolete and plagued with unpatched bugs and security issues, so it's not supported — for very good reasons!); and he provides a lot of PHP extensions, too. Sadly, ffmpeg-php is not one of them... There is a good reason for the overall lack of support of ffmpeg-php. Allegedly, the original repository for that was hosted at Sourceforge but has been abandoned in 2007. The recommended package these days is PHP-FFMpeg which is constantly being updated, and ought to be easily installed using composer — get it before starting your compilation!

Alternatively, instead of relying on an external non-official PHP extension (albeit one that is both popular and updated regularly!), you ought to launch the ffmpeg binary using shell_exec(). This is the officially recommended approach, mostly because converting videos always takes a long time, and the authors of that recommendation suggest a simple architecture where the PHP script basically launches ffmpeg in the background, accepting batches of videos for processing. The page is a bit old, but the technique shown is sound.


我在Linux mint上使用XAMPP,如果你没有,它默认安装

sudo apt-get install php7.0-dev
// or
sudo apt-get install php-dev

知道更多