PHP安装swoole扩展

风流意气都作罢 提交于 2019-12-19 10:00:53

环境:gcc
yum install gcc

第一步:下载swoole包
wget http://pecl.php.net/package/swoole
第二步:解压,并进入
执行:/usr/local/php/bin/phpize
可能会报错
Cannot find autoconf. Please check your autoconf installation and the? $PHP_AUTOCONF? environment
variable is set correctly and then rerun this script.
解决错误
yum -y install gcc automake autoconf libtool make(安装make)
wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
tar -zvxf m4-1.4.9.tar.gz
cd m4-1.4.9/
./configure && make && make install
cd ../
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz
tar -zvxf autoconf-2.62.tar.gz
cd autoconf-2.62/
./configure && make && make install
然后继续执行/usr/local/php/bin/phpize
第三步:执行./configure --with-php-config=/usr/local/php/bin/php-config
可能会报错
configure: error: C++ preprocessor “/lib/cpp” fails sanity
check See `config.log’ for more details
解决办法:
出现该情况是由于c++编译器的相关package没有安装,以root用户登陆,在终端上执行:
  # yum install glibc-headers
  # yum install gcc-c++
最后找到php.ini
在里面找到extension_dir="(复制执行完上一步后Installing shared extensions:显示的路径)";
添加extension=swoole.so
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!