252

我一直打算安装ffmpeg为我的 PHP 设置的扩展。所以在我可以安装它之前,我需要phpize它。我安装php5-devsudo apt-get install 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

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

找到 config.m4 没有返回任何内容。

这里有什么指示我如何获得phpize并因此ffmpeg启动和运行?

4

18 回答 18

561

对于最新版本的 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
于 2012-01-24T04:57:54.283 回答
75

For PHP7 Users

7.1

sudo apt install php7.1-dev

7.2

sudo apt install php7.2-dev

7.3

sudo apt install php7.3-dev

7.4

sudo apt install php7.4-dev

If not sure about your PHP version, simply run command php -v

于 2016-07-03T10:23:11.920 回答
27

哦..我通过键入/usr/bin/phpize而不是仅运行它phpize

于 2010-06-24T10:43:52.503 回答
16

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

yum install php-devel

对于 PHP 7,您需要:

yum install php70-php-devel
于 2015-06-08T16:06:02.503 回答
8

嗯...实际上我不知道这是如何解决的?但是以下步骤为我解决了它:

find / -name 'config.m4'

现在看看 config.m4 是否在你想要 phpize 的文件夹中的任何位置。转到该文件夹​​并直接在其中运行 phpize 。

于 2012-01-13T09:33:19.683 回答
8

Step - 1: If you are unsure about the php version installed, then first run the following command in terminal

php -v

Output: the above command will output the php version installed on your machine, mine is 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

Step 2: Then to install phpize run the following command, Since my php version is 7.2.3. i will replace it with 7.2, so the command will be,

sudo apt-get install php7.2-dev

Step 3: Done!

Alternate method(Optional): To automatically install the phpize version based on the php version installed on your machine run the following command.

sudo apt-get install php-dev

This command will automatically detect the appropriate version of php installed and will install the matching phpize for the same.

于 2018-05-20T17:13:16.327 回答
5

In Ubuntu 16.04, you can install phpize with the command

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

which is equivalent to

apt-get install php7.1-dev // for php 7.1
于 2016-06-07T08:13:52.927 回答
5

For ubuntu 14.04LTS with php 7, issue:

sudo apt-get install php-dev

Then install:

pecl install memcache
于 2016-09-06T12:35:03.800 回答
4

If you're having problems with phpize not found on CentOS7.x after you have installed the relevant devel tools for your version/s of PHP, this path finally worked for me:

For PHP 7.2.x

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

For PHP 7.3.x

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

For PHP 7.4.x

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

Run this in your folder containing the downloaded PHP extension, for example in line 3 below:

Example based on installing the PHP v7.3.x Brotli Extension from 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
于 2019-06-28T12:06:24.580 回答
2

Install from linux terminal

sudo apt-get install <php_version>-dev

Example :

sudo apt-get install php5-dev     #For `php` version 5
sudo apt-get install php7.0-dev   #For `php` version 7.0
于 2017-09-07T09:48:43.710 回答
2

Of course in PHP7.2

sudo apt-get install php7.2-dev
于 2018-05-09T19:14:12.863 回答
1

这可能对 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"到 php.ini(通常位于/etc/php5/apache2/php.ini

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

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

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

http.so 是启动还是失败?

于 2013-06-11T17:17:10.660 回答
1

For ubuntu with Plesk installed run apt-get install plesk-php56-dev, for other versions just change XX in phpXX (without the dot)

于 2017-06-29T16:20:27.547 回答
1

For instance, if you wanted to use the "phpize" command for PHP 5.6, you would use the full path: Code:

/opt/cpanel/ea-php56/root/usr/bin/phpize
于 2018-05-01T12:44:09.680 回答
0

Go to the downloaded folder and there you find config.m4. Open the terminal and run phpsize.

于 2018-04-07T11:23:26.453 回答
0

I had this exact problem on macOS in 2018.

For me, first running brew install php before sudo pecl install mongodb did the trick.

于 2018-11-27T08:04:31.513 回答
0

You didn't specify what operating system you're using, and 90% of the answers assume Ubuntu/Debian Linux because of the apt-get install autoconf automake libtool m4 command that you posted (and over half expect you to be running CPanel), so I'm giving you a slightly more generic solution which ought to work on any Un*x clone (including Microsoft's WSL!).

You will need at least a few prerequisites:

  1. A working C/C++ compiler — GCC or clang being the most popular options these days.
  2. 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.
  3. 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...
  4. 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.

于 2021-12-22T11:34:17.767 回答
0

I am using XAMPP on Linux mint and it is by default installed if your don't have

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

know more

于 2022-01-22T00:34:59.627 回答