报错:PHP Warning: PHP Startup: Unable to load dynamic library 'swoole.so' (tried: /usr/lib/php/20180731/swoole.so (/usr/lib/php/20180731/swoole.so: undefined symbol: _zval_ptr_dtor), /usr/lib/php/20180731/swoole.so.so (/usr/lib/php/20180731/swoole.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
php版本7.3,pecl和wget两种安装方式都是试过了不行。哪位大神能帮忙解决下,小弟不胜感谢
首先 访问swoole官网 : 点击打开链接 下载源码包 我通过的git下载
进入swoole 目录 通过phpize(注:使用phpize命令 必须开启php-dev扩展 ) 命令 扩展php模板 ,生成./configure文件
使用 ./configure 命令 作用 :一.对即将安装的软件进行配置 二. 检测当前环境是否满足软件安装的依赖关系
4. 使用make 及 sudo make install
5.安装成功 使用 ln -s 软连接 开启php-swoole扩展 例如: sudo ln -s /etc/php/7.2/mods-available/swoole.ini /etc/php/7.2/cli/conf.d/20-swoole.ini (注: 没有swoole.ini 需要自行创建swoole.ini文件)
作者:hg421
来源:CSDN
原文:https://blog.csdn.net/hg421/article/details/80818725
版权声明:本文为博主原创文章,转载请附上博文链接!
root@shen-Lenovo-XiaoXin-700-15ISK:~/swoole-src# phpize
Configuring for:
PHP Api Version: 20170718
Zend Module Api No: 20170718
Zend Extension Api No: 320170718
root@shen-Lenovo-XiaoXin-700-15ISK:~/swoole-src# ./configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: error: Cannot find php-config. Please use --with-php-config=PATH
改成root@shen-Lenovo-XiaoXin-700-15ISK:~/swoole-src# ./configure --with-php-config=/usr/local/php/bin/php-config后执行成功
make && make install 命令也能执行成功
软链接也添加了,执行php 7.3 -m还是看不到swoole扩展