PHP 开启扩展包三种方式
1 已安装但是没有开启
> # find /usr/local/php-fpm/ -name sockets.so
;extension=sockets.so
2 PHP源码包自带安装包, 但是初始安装时没有编译
> # cd /php-7.2.29/ext/opcache
> # /usr/local/php-fpm/bin/phpize
> # ./configure --with-php-config=/usr/local/php-fpm/bin/php-config
> # make
> # make install
> # vim /usr/local/php-fpm/etc/php.ini
extension=opcache.so
3 扩展包需要自己下载, 编译后安装扩展包
> # wget http://pecl.php.net/get/redis-4.3.0.tgz
> # tar -zxvf redis-4.3.0.tgz
> # cd redis-4.3.0
> # /usr/local/php-fpm/bin/phpize
> # ./configure --with-php-config=/usr/local/php-fpm/bin/php-config
> # make
> # make install
> # vim /usr/local/php-fpm/etc/php.ini
extension=redis.so
查询方式:
> # php -m
查看php拓展.so文件安装目录
> # php -i | grep extension_dir