LNMP安装PHP fileinfo扩展模块

46    2017-08-25 10:34

#安装composer

curl -sS https://getcomposer.org/installer php  #安装到当前目录

mv composer.phar /usr/local/bin/composer

composer 

root@fz-xen1[19:07:48]:/home/wh/attendize$composer

   ______

  / ____/___  ____ ___  ____  ____  ________  _____

 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/

/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /

\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/

                    /_/

Composer version 1.2.0 2016-07-19 01:28:52#

#执行

root@fz-xen1[18:52:53]:/home/wh/attendize$composer install

Loading composer repositories with package information

Installing dependencies (including require-dev) from lock file

Your requirements could not be resolved to an installable set of packages.


  Problem 1

    - Installation request for intervention/image 2.3.x-dev -> satisfiable by intervention/image[2.3.x-dev].

    - intervention/image 2.3.x-dev requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.

  Problem 2

    - Installation request for intervention/image dev-master -> satisfiable by intervention/image[dev-master].

    - intervention/image dev-master requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.


  To enable extensions, verify that they are enabled in those .ini files:

    - /usr/local/php/etc/php.ini

  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

解决:


安装PHP程序的时候,提示The fileinfo extension is required.,缺少fileinfo 扩展,因为LNmpA没有自行开启,所以需要我们手工去开启fileinfo 扩展。

 

方法如下
第一步:找到lnmpa安装源位置:

cd /lnmp1.3-full/src/php-5.6.9/ext/fileinfo/

 

第二步:

/usr/local/php/bin/phpize


返回类似下面的信息:

Configuring for:

PHP Api Version:         20131106

Zend Module Api No:      20131226

Zend Extension Api No:   220131226


phpize是什么东西呢?
php官方的说明:http://php.net/manual/en/install.pecl.phpize.php
phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块,比如你想在原来编译好的php中加入memcached或者ImageMagick等扩展模块,可以使用phpize。

 

第三步:

./configure --with-php-config=/usr/local/php/bin/php-config
make && make install


返回类似下面信息:

Build complete.

Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/


表明安装成功了。

 

第四步:
/usr/local/php/etc/php.ini 添加扩展:

extension=fileinfo.so

/etc/init.d/php-fpm restart


#

PHP已编译模块检测
Core  date  ereg  libxml  openssl  pcre  sqlite3  zlib  bcmath  ctype  curl  dom  filter  
ftp  gd  gettext  hash  iconv  intl  json  mbstring  mcrypt  SPL  session  standard  pcntl  
mysqlnd  PDO  pdo_mysql  pdo_sqlite  Phar  posix  Reflection  mysqli  shmop  SimpleXML  soap  sockets  mysql  
sysvsem  tokenizer  xml  xmlreader  xmlrpc  xmlwriter  xsl  zip  cgi-fcgi  fileinfo  mhash  Zend Guard Loader 

#然后重新执行composer

composer install




  • 请先登录 ~\(≧▽≦)/~,再发表评论 /(ㄒoㄒ)/~~
  • 评论内容不要超过233个字符 (⊙o⊙)哦
  • 请注意单词拼写,以及中英文排版,参考此页