下面由centos教程栏目给大家介绍如何在centos下kanglephp安装swoole扩展,希望对需要的朋友有所帮助!
如何在centos下kanglephp安装swoole扩展
首先,测试环境centos6 64位及centos7,easypanel2.6.26,kangle3.5.14 php7.3.0
如果是centos7请忽略gcc安装,首先升级gcc库到4.8,
curl -Lks http://yum.osyum.com/linux/gcc/hop5.repo > /etc/yum.repos.d/hop5.repoyum install gcc gcc-g++ -y
可以忽略接下来安装nghttp
wget http://yum.osyum.com/linux/nghttp/nghttp2-1.35.0.tar.gztar -zxvf nghttp2-1.35.0.tar.gzcd nghttp2-1.35.0./configuremakemake install
接下来我们下载swoole扩展,https://github.com/swoole/swoole-src,我们用php7.3来安装swoole扩展,其它版本安装也是一样的,注意,PHP目录要搞对。
wget --no-check-certificate https://codeload.github.com/swoole/swoole-src/zip/master -O swoole-src-master.zipunzip swoole-src-master.zipcd swoole-src-master/vhs/kangle/ext/php73/bin/phpize./configure --with-php-config=/vhs/kangle/ext/php73/bin/php-configmakemake install
![[centos]centos下kanglephp安装swoole扩展](https://waterbear.pw/ueditor/… "[centos]centos下kanglephp安装swoole扩展")
出现这样证明成功一半了,接着让php支持swoole,接下来我们来做php73支持swool的扩展
mv /root/php-7.3.0/php.ini-development /vhs/kangle/ext/php73/etc/php.d/php.ini
编辑vi /vhs/kangle/ext/php73/etc/php.d/php.ini
在尾部加上
extension = "/vhs/kangle/ext/php73/lib/php/extensions/no-debug-non-zts-20180731/swoole.so"
保存退出,如果你还有编译其它模块,也可以加上
查看是否支持swoole模块
/vhs/kangle/ext/php73/bin/php -m
列表中有swoole证明完全成功
![[centos]centos下kanglephp安装swoole扩展](https://waterbear.pw/ueditor/… "[centos]centos下kanglephp安装swoole扩展")
注意重启后,kangle的php7.3可能会使用/vhs/kangle/ext/php73/etc/php.d/php.ini作为新的php.ini,所以你还需要对php.ini作出安全处理
在disable_functions=后加入
eval,passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,disk_total_space,disk_free_space,error_log,putenv,popen,ini_set,chmod,assert,pcntl_exec,phpfunc;
保存退出.