【问题标题】:php extension fileinfo install in Ubuntu(15.10)在 Ubuntu(15.10) 中安装 php 扩展文件信息
【发布时间】:2016-04-20 08:18:10
【问题描述】:

我尝试在 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 扩展? 如何启用此扩展程序?

【问题讨论】:

    标签: php ubuntu


    【解决方案1】:

    从 PHP 5.3.0 开始默认启用此扩展。

    在此之前,fileinfo 是一个 PECL 扩展,但不再保留在那里。

    参考: http://www.php.net/manual/en/fileinfo.installation.php

    【讨论】:

    • 如何启用这个扩展?
    • 在 Ubuntu 上默认启用。检查您的 phpinfo 是否已启用。您可以在 php.ini 中设置您的扩展
    • 我检查了 phpinfo,它就在那里:) 我如何在 php.ini 中启用 fileinfo,我在 php.ini 中找到 fileinfo,它似乎不存在!
    • Fileinfo 在 php.ini 中没有定义配置指令
    • 尝试使用示例代码并检查它是否有效php.net/manual/en/function.finfo-file.php 这应该是因为从 PHP 5.3.0 开始启用 fileinfo。
    猜你喜欢
    • 2013-01-08
    • 1970-01-01
    • 2017-10-28
    • 1970-01-01
    • 1970-01-01
    • 2015-04-30
    • 1970-01-01
    • 2016-05-23
    • 1970-01-01
    相关资源
    最近更新 更多