下载源代码包后,在终端进入源码目录,执行下面的命令进行编译和安装
phpize
./configure
make
make install
如果你是源代码安装的PHP,会出现版本和编译时使用的phpize和php-config不对应,需要使用绝对路径来进行编译。使用绝对路径执行PHP
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config
make && make install
配置php.ini
安装成功后会出现扩展路径地址,把扩展加入到php.ini
extension=xxxxx.so