![Ubuntu(15.10)中安装php扩展fileinfo](https://linux22.com/image/1135316/Ubuntu(15.10)%E4%B8%AD%E5%AE%89%E8%A3%85php%E6%89%A9%E5%B1%95fileinfo.png)
我尝试在 Ubuntu(15.10) 中安装 php fileinfo 扩展并出现错误:
sudo pecl install fileinfo
错误:
WARNING: "pear/Fileinfo" is deprecated in favor of "channel://php-src/ext/fileinfo/in php sources"
WARNING: channel "pear.php.net" has updated its protocols, use "pecl channel-update pear.php.net" to update
downloading Fileinfo-1.0.4.tgz ...
Starting to download Fileinfo-1.0.4.tgz (5,835 bytes)
.....done: 5,835 bytes
3 source files, building
running: phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module
If the command failed with 'phpize: not found' then you need to install php5-dev packageYou can do it by running 'apt-get install php5-dev' as a root userERROR: `phpize' failed
然后我尝试了这个命令:
sudo apt-get install php5-dev
输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-dev is already the newest version.
The following packages were automatically installed and are no longer required:
linux-headers-4.2.0-16 linux-headers-4.2.0-16-generic
linux-image-4.2.0-16-generic linux-image-extra-4.2.0-16-generic
linux-signed-image-4.2.0-16-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
如何安装 php fileinfo 扩展?
答案1
根据您在此处提供的错误消息,您需要运行/usr/bin/phpize
命令在模块的顶层源目录中。
如果上一步失败并出现phpize: not found
错误消息,则仅需要安装 php5-dev 包(这种情况不太可能发生,因为您已经安装了它)