启动workman报错
Workerman[start.php] start in DEBUG mode
stream_socket_server() has been disabled for security reasons in file /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php on line 2214
PHP Fatal error: Uncaught Exception in /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php:2216
Stack trace:
#0 /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php(646): WorkermanWorker->listen()
#1 /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php(504): WorkermanWorker::initWorkers()
#2 /home/wwwroot/laykefu/vendor/workerman/Config/start.php(37): WorkermanWorker::runAll()
#3 {main}
thrown in /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php on line 2216
Fatal error: Uncaught Exception in /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php:2216
Stack trace:
#0 /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php(646): WorkermanWorker->listen()
#1 /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php(504): WorkermanWorker::initWorkers()
#2 /home/wwwroot/laykefu/vendor/workerman/Config/start.php(37): WorkermanWorker::runAll()
#3 {main}
thrown in /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php on line 2216
原因是:PHP 把 stream_socket_erver()
函数被禁用了
解决办法
找到php.ini
文件,查找disable_functions
这个一项中是否禁用了stream_socket_server()
这个函数
find / -name php.ini # 查找php.ini所在位置
vim /usr/local/php/etc/php.ini # 打开编辑php.ini
按esc键,输入:/stream_socket_server
,按n
开始查找
检查函数是不是在 disable_functions
这个一项里面,这一项是禁用方法的意思
如果有这个函数,则删除掉,按esc键,输入wq
保存退出
重启php-fpm
service php-fpm restart