#soap扩展
编译soap.so扩展~
soap扩展
进入安装原php的源码目录,
cd ext
cd soap
phpize
./configure --with-php-config=/var/php/bin/php-config (一定要有php-config这个文件的路径,不然会报错!)
make
就会在phpdir/ext/soap/modules/下生成soap.so的文件
php -i | grep ini 找到php.ini file
vi 那个php.ini
找到extension_dir = /usr/lib/php/extensions
将编译的soap.so放到里面
添加php.ini
extension=soap.so
[soap]
; enables or disables wsdl caching feature.
soap.wsdl_cache_enabled=1
; sets the directory name where soap extension will put cache files.
soap.wsdl_cache_dir=/tmp
; (time to live) sets the number of second while cached file will be used
; instead of original one.
soap.wsdl_cache_ttl=86400
查看php -i | 是否安装成功
重启web服务
service nginx restart
service php-fpm stop
service php-fpm start
#可惜由于影响到先有程序...只能动态加载扩展
程序动态加载模块
if (!extension_loaded('soap')) {
if (strtoupper(substr(php_os, 0, 3)) === 'win') {
dl('soap.dll');
ini_set('soap.wsdl_cache_dir',"c:\windows\temp");
} else {
dl('soap.so');
ini_set('soap.wsdl_cache_dir',"/tmp");
}
ini_set('soap.wsdl_cache_enabled','1');
ini_set('soap.wsdl_cache_ttl',86400);
}
其他常用扩展函数
extension_loaded('soap')//是否加载了soap扩展
dl('soap.so');//加载soap扩展
ini_set('soap.wsdl_cache_dir',/tmp);//设置扩展参数
array get_extension_funcs ( string $module_name )
array get_loaded_extensions ([ bool $zend_extensions= false ] )