CentOS 7 64bit如何安装php soap模块

错误提示:
Your server does not have the SOAP Client class enabled – some gateway plugins which use SOAP may not work as expected.
查看soap模块是否安装的办法:在php的安装目录下运行php -m来查看
/usr/bin/php -m |grep 'sosap'

如果没有安装,则进入php的安装源文件夹

cd /tmp && tar zxvf php-5.4.16.tar.gz && cd php-5.4.16/ext/soap

此处自己去php官方下载相应的版本。

进入后运行phpize命令
/usr/bin/phpize

碰到错误提示,安装两个依赖包解决

# /usr/bin/phpize
Can’t find PHP headers in /usr/include/php
The php-devel package is required for use of this command.
yum install php-pear
yum install php-devel

查看信息是否有还有错误,没有出错的话运行如下命令:

./configure –-with-php-config=/usr/local/php/bin/php-config –enable-soap
./configure --with-php-config=/usr/bin/php-config --enable-soap

然后是安装编译

make
最后是安装
make install
安装好之后会提示soap.so文件的保存路径
# make install
Installing shared extensions:     /usr/lib64/php/modules/
接着修改php.ini文件
vi /etc/php.ini
查找/etc/php.ini中的extension_dir = “./”,默认是注释掉的
修改为

extension_dir = "/usr/lib64/php/modules/"

并在此行后增加如下,然后保存:

extension = "soap.so"

执行php-fpm看看有没有错误

没有php-fpm,安装一个吧
yum install -y php-fpm
重新启动apache:
systemctl restart php-fpm
再运行php -m就已经能看到扩展的soap模块了。