PHP之soap
扩展安装:
1.下载源码包
cd /root & wget -O php7.1.27.tar.gz http://cn2.php.net/get/php-7.1.27.tar.gz/from/this/mirror
2.编译
tar -xvf php7.1.27.tar.gz cd php7.1.27 ./configure --enable-soap=shared make
注意:如果收到类似于以下内容的错误,则需要安装libxml2:
error: xml2-config not found. Please check your libxml2 installation
您可以通过yum存储库安装libxml2:
有时候会出现make错误的情况:
ext/openssl/.libs/openssl.o: In function `sk_X509_pop': /usr/local/include/openssl/x509.h:97: undefined reference to `OPENSSL_sk_pop' ext/openssl/.libs/openssl.o: In function `php_openssl_asn1_time_to_time_t': /root/php-7.2.8/ext/openssl/openssl.c:940: undefined reference to `ASN1_STRING_get0_data' /root/php-7.2.8/ext/openssl/openssl.c:955: undefined reference to `ASN1_STRING_get0_data' /root/php-7.2.8/ext/openssl/openssl.c:955: undefined reference to `ASN1_STRING_get0_data' ext/openssl/.libs/openssl.o: In function `zm_info_openssl': /root/php-7.2.8/ext/openssl/openssl.c:1590: undefined reference to `OpenSSL_version' ext/openssl/.libs/openssl.o: In function `zm_startup_openssl': /root/php-7.2.8/ext/openssl/openssl.c:1436: undefined reference to `OPENSSL_init_ssl' ext/openssl/.libs/openssl.o: In function `zif_openssl_decrypt': /root/php-7.2.8/ext/openssl/openssl.c:6712: undefined reference to `EVP_CIPHER_CTX_reset' ext/openssl/.libs/openssl.o: In function `zif_openssl_encrypt': /root/php-7.2.8/ext/openssl/openssl.c:6625: undefined reference to `EVP_CIPHER_CTX_reset' ext/openssl/.libs/openssl.o: In function `zif_openssl_digest': /root/php-7.2.8/ext/openssl/openssl.c:6306: undefined reference to `EVP_MD_CTX_new' /root/php-7.2.8/ext/openssl/openssl.c:6329: undefined reference to `EVP_MD_CTX_free' ext/openssl/.libs/openssl.o: In function `sk_X509_num': /usr/local/include/openssl/x509.h:97: undefined reference to `OPENSSL_sk_num' ext/openssl/.libs/openssl.o: In function `sk_X509_value': /usr/local/include/openssl/x509.h:97: undefined reference to `OPENSSL_sk_value' ext/openssl/.libs/openssl.o: In function `sk_X509_CRL_num': /usr/local/include/openssl/x509.h:226: undefined reference to `OPENSSL_sk_num' ext/openssl/.libs/openssl.o: In function `sk_X509_CRL_value': /usr/local/include/openssl/x509.h:226: undefined reference to `OPENSSL_sk_value' ext/openssl/.libs/openssl.o: In function `zif_openssl_dh_compute_key': /root/php-7.2.8/ext/openssl/openssl.c:4911: undefined reference to `EVP_PKEY_get0_DH' ext/openssl/.libs/openssl.o: In function `zif_openssl_pkey_get_details': /root/php-7.2.8/ext/openssl/openssl.c:4823: undefined reference to `EVP_PKEY_get0_EC_KEY'
尝试清理编译文件再重新编译
make clean
make
3.修改配置文件,添加扩展
1)查看扩展加载目录
php -i|grep extension_dir
2)将扩展拷贝到该目录
cp modules/soap.so /usr/local/php7/lib/php/2016322/soap.so
3)配置文件中添加
extension='/usr/lib/php/20160303/soap.so'
4)重启php-fpm
kill -USR2 `cat /usr/local/php7/php-fpm.pid`