一、如果已经有过拓展(一般php会自带安装), 可以直接在php.ini中启用
二、如果第一步未生效, 如果进行动态编译安装
首先
确认你php根目录在哪, 根目录下的/etc (或ext)下有无soap这个目录, 如果没有
请去下载php对应版本的源码包, 找到soap放入你服务器上php的对应目录:
图片.png
其次
确认phpize 的目录, cd 到soap(我的是/opt/remi/php56/root/etc/soap)目录, 执行下面命令进入编译模式
/opt/remi/php56/root/usr/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "zh_CN.GB2312:en_US:en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "zh_CN.GB2312:en_US:en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
./configure --with-php-config=[php可执行文件目录]-config --enable-soap
make
make install
最后
图片.pngInstalling shared extensions: /usr/local/php5/lib/php/extensions/no-debug-zts-20060613/
提示编译后的soap.so文件保存在了/usr/local/php5/lib/php/extensions/no-debug-zts-20060613/目录下。
如果soap生成位置与你extension_dir位置不一致, 使用绝对路径引入
extension = /opt/remi/php56/root/usr/lib64/php/modules/soap.so
./configure报错:
checking for gawk... gawk
checking whether to enable SOAP support... yes, shared
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
解决方法:
检查是否安装了libxm包
[root@XKWB3403 php-5.3.8]# rpm -qa |grep libxml2
libxml2-2.6.26-2.1.12
libxml2-python-2.6.26-2.1.12
重新安装libxml2和libxml2-devel包
libxml2-devel.x86_64
然后重新执行./configure完整命令就行
网友评论