lnmp1.6 install fileinfo extension

cd /root/lnmp1.6/src //进入lnmp安装目录

tar xvf php-5.6.40.tar.bz2 //解压php

cd php-5.6.40/ext/fileinfo //进入fileinfo 扩展的目录

phpize
 ./configure --with-php-config=/usr/local/php/bin/php-config //运行配置

make && make install 编译模块

vim /usr/local/php/etc/php.ini //编辑php.ini添加下面代码

extension=/usr/local/php/lib/php/extensions/no-debug-zts-20131226/fileinfo.so

Or check the steps: https://www.jianshu.com/p/c145ed4478af

 Extended knowledge:

About phpize

Application scenarios
In the process of using php, we often need to add some PHP extension libraries. But recompiling php is quite annoying, so at this time we can use phpize to add extensions to php. And the extension library compiled by phpize can be enabled or disabled at any time, which is more flexible.

The usage method
extension is the extension package to be mounted

wget extension.tar.gz download the corresponding extension package and unzip it.
cd extension/ switch to
/php/bin/phpize in the extension directory and run the phpize file in the php installation directory. At this time, the corresponding configure file will be generated in the extension directory.
/configure --with-php-config=/php/bin/php-config Run configuration, if you only have one version of php installed on your server, you don't need to add --with-php-config. The following parameters are just to tell phpize which version of the extension to build based on.
make && make install Compile the module After
compiling the module, you need to enable php to enable it. Add extension.so to the php.ini file and open it. Restart the php service.
Function
In fact, phpize is a running script, the main function is to detect the php environment and generate the corresponding configure file in a specific directory, so that after makeinstall, the generated .so file will be automatically loaded under the php extension directory.

Guess you like

Origin blog.csdn.net/qq_39418742/article/details/101536272