Home > Article > Backend Development > soap extension compilation, loading and dynamic loading
#soap extension
Compile soap.so extension~
SOAP extension
Enter the source code directory where the original php is installed,
cd ext
cd soap
phpize
./configure --with-php-config= /var/php/bin/php-config (There must be the path to the php-config file, otherwise an error will be reported!)
make
will generate the soap.so file under PHPDIR/ext/soap/modules/
php -i | grep ini Find the php.ini file
vi that php.ini
Find extension_dir = "/usr/lib/php/extensions"
Put the compiled soap.so in it
Add php .ini
extension=soap.so
[soap]
;Enables or disables WSDL caching feature.
soap.wsdl_cache_enabled=1
; 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
Check whether the installation is successful with php -i |
Restart the web service
service nginx restart
service php-fpm stop
service php-fpm start
#Unfortunately, due to the impact on the existing program...only the extension can be loaded dynamically
The program dynamically loads the module
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); }
Other commonly used extension functions
extension_loaded('soap')//Whether the soap extension is loaded
dl('soap.so');//Loading the soap extension
ini_set('soap.wsdl_cache_dir',"/tmp" );//Set extension parameters
array get_extension_funcs ( string $module_name )
array get_loaded_extensions ([ bool $zend_extensions= false ] )