首先,測試環境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;
儲存退出.