Tag Archives: PHP stream_socket_server()

Workman Run Error: stream_socket_server() has been disabled for security reasons

Start the workman and report an error

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): Workerman\Worker->listen()
#1 /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php(504): Workerman\Worker::initWorkers()
#2 /home/wwwroot/laykefu/vendor/workerman/Config/start.php(37): Workerman\Worker::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): Workerman\Worker->listen()
#1 /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php(504): Workerman\Worker::initWorkers()
#2 /home/wwwroot/laykefu/vendor/workerman/Config/start.php(37): Workerman\Worker::runAll()
#3 {main}
  thrown in /home/wwwroot/laykefu/vendor/workerman/workerman/Worker.php on line 2216

The reason is: PHP the stream_socket_erver()function is disabled

Solution

Find the php.inifile and find disable_functionswhether stream_socket_server()this function is disabled in this item

find / -name php.ini # Find the location of php.ini
vim /usr/local/php/etc/php.ini # open edit php.ini

Press esc key, enter :/stream_socket_server, press nstart search

Check the function is not in disable_functionsthis one there, this one is meant Prohibited Method

If there is this function, delete it, press the esc key, enter to wqsave and exit

Restart php-fpm

service php-fpm restart