#laravel-swoole 的安装
1、composer require swooletw/laravel-swoole
2、参照'解决中的内容'
3、php -i | grep php.ini (确定php.ini的位置,phpinfo查看的可能不准)
4、extension=swoole.so(写入php.ini文件中)
5、php -m | grep swoole (查看是否安装成功,如果安装成功,会输出 swoole)
6、安装完成之后必须重启php-fpm(sudo /etc/init.d/php7.2-fpm restart)
报错解决:
报错:PHP Warning: PHP Startup: Unable to load dynamic library 'swoole.so' (tried: /usr/lib/php/20170718/swoole.so (/usr/lib/php/20170718/swoole.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/swoole.so.so (/usr/lib/php/20170718/swoole.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
解决: got the same problem. here is my way to solve it. If you change your default php version, for example to php7.2, make sure you also install php7.2-dev package
sudo apt install php7.2-dev
run php-config to make sure it point to php7.2 version not php7.0
before run sudo pecl install swoole, check the php extension-dir not have swoole.so file (for example your php7.2 extension-dir in /usr/lib/php/20170718). so if any swoole.so file in it, remove it manually). the rest installation steps should be straight forward and the error should be gone.
网友评论