PHP安装swoole扩展

环境: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
上一篇:Leetcode--Java--368. 最大整除子集


下一篇:php编译扩展库时报错:Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF envi