通过phpize为php在不重新编译php情况下安装模块openssl

假定:
php编译安装路径:/usr/local/php/
apache编译安装路径:/usr/local/apache/
php配置文件路径:/etc/php.ini
php安装源路径:/usr/source/php-5.3.9/

[root@localhost ~]# cd /usr/source/php-5.3.9/ext/openssl/

[root@localhost openssl]# /usr/local/php/bin/phpize
Cannot 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/phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend 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模块

<?php
echo phpinfo();
?>

检验方法2:

[root@localhost openssl]# cd ~
[root@localhost ~]# vi test.php
php 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文件,表示安装成功

发表评论

电子邮件地址不会被公开。 必填项已用*标注