php7.2安装以及使用pecl安装swoole

少于 1 分钟读完

//php安装
sudo apt install php7.2
sudo apt install php7.2-fpm php7.2-mysql 
php7.2-bz2 php7.2-common php7.2-curl php7.2-dev php7.2-gd php7.2-imap php7.2-json php7.2-mbstring php7.2-zip
sudo apt install php-pear
sudo pecl install swoole
//添加swoole扩展
sudo nano /etc/php/7.2/cli/php.ini
extension=swoole.so
//重启
sudo service php7.2-fpm restart

高版本php使用pecl安装swoole可能导致问题:

darkwind@darkwind-pc:/etc/php/7.2/cli/conf.d$ php -m | grep swoole
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

参考如下博客: swoole安装报错详解

homestead(多PHP版本)安装swoole

其实问题不太一样,这边的原因是没有装mysql扩展,装上就好了

留下评论

您的电子邮箱地址并不会被展示。请填写标记为必须的字段。 *

正在加载...