1. 新增安装扩展模块的位置
[root@node_22 ~]# ls /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/
opcache.a opcache.so swoole.so
2. 所有可用模块位置
[root@node_22 ~]# ls /usr/local/php7/include/php/ext/
date filter hash json mbstring mysqlnd pdo session sockets sqlite3 swoole
dom gd iconv libxml mysqli pcre phar simplexml spl standard xml
3. 查看当前php的配置文件(默认在php/etc)
[root@node_22 ~]# /usr/local/php7/bin/php --ini
Configuration File (php.ini) Path: /usr/local/php/etc
Loaded Configuration File: /usr/local/php/etc/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
4. 修改php.ini文件
加上 extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/swoole.so
5. 重启apche(nginx)和php-fpm
6. 查看php当前可用模块
[root@node_22 ~]# /usr/local/php7/bin/php -m
[PHP Modules]
bz2
calendar
cgi-fcgi
Core
ctype ....
注:编译安装可指定php.ini的路劲(多PHP版本共存的情况)
--with-config-file-path=/usr/local/php/etc