前提:
1.php >=7.2
2.已安装nginx
已经安装 pecl
执行命令
pecl install swoole
出现错误
Warning: putenv() has been disabled for security reasons in
PEAR/Builder.php on line 367 PHP Warning: putenv() has been disabled
for security reasons in /www/server/php/72/lib/php/PEAR/Builder.php on
line 367Warning: putenv() has been disabled for security reasons in
/www/server/php/72/lib/php/PEAR/Builder.php on line 367 running:
phpizeWarning: popen() has been disabled for security reasons in
PEAR/Builder.php on line 525 PHP Warning: popen() has been disabled
for security reasons in /www/server/php/72/lib/php/PEAR/Builder.php on
line 525Warning: popen() has been disabled for security reasons in
/www/server/php/72/lib/php/PEAR/Builder.php on line 525 ERROR: failed
to run `phpize’
原因: PHP 默认禁用 putenv,popen
打开php.ini文件, 查找到disable_functions,在等于号(=)后面添加需禁用的函数名,去除即可 如下:
disable_functions =syslog,readlink,passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,symlink,popen,putenv,fsocket,fsockopen
继续执行:
pecl install swoole
发现让确定
enable sockets supports? [no] : enable openssl support? [no] : enable http2 support? [no] : enable mysqlnd support? [no] :
参考: https://blog.csdn.net/taoshihan/article/details/101249348
安装上了
输入 php -m 查看是否有 swoole
完事!!
其他问题参考:
https://wiki.swoole.com/#/question/install