假定:php编译安装路径:/usr/local/php/apache编译安装路径:/usr/local/apache/php配置文件路径:/etc/php.iniphp安装源路径:/usr/source/php-5.3.9/[root@localhost ~]# cd /usr/source/php-5.3.9/ext/openssl/[root@localhost openssl]# /usr/local/php/bin/phpizeCannot find config.m4.Make sure that you run '/usr/local/php/bin/phpize' in the top level source directory of the module[root@localhost openssl]# cp ./config0.m4 ./config.m4[root@localhost openssl]# /usr/local/php/bin/phpizeConfiguring for:PHP Api Version:         20090626Zend Module Api No:      20090626Zend Extension Api No:   220090626[root@localhost openssl]# ./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config注:如果不想使用php自带的ext里的openssl的话 可使用参数“--with-openssl=DIR” Include OpenSSL support (requires OpenSSL >= 0.9.6)[root@localhost openssl]# make[root@localhost openssl]# make install在php.ini中加载openssl.so[root@localhost openssl]# vi /etc/php.ini加入:extension = "openssl.so"重启apache:[root@localhost ~]# /usr/local/apache/bin/apachectl -k restart检验方法1:通过phpinfo检验是否加载了openssl模块

echo phpinfo(); 

?>检验方法2:

[root@localhost openssl]# cd ~[root@localhost ~]# vi test.phpphp code:error_reporting(E_ALL);$a = file_get_contents('https://id3check.gb.co.uk/gbportalinternational/aspx/id3check_1b.asmx?WSDL');var_dump($a);[root@localhost ~]# /usr/local/php/bin/php ~/test.php返回wsdl xml文件,表示安装成功

查看原文