切换到php安装目录的etx/openssl目录

cd /home/tao/soft/php-5.2.13/ext/openssl
openssl目录下有个config.w32和config0.m4,把config0.m4改名为config.m4(不清楚什么原因,必须这么改,很重要!!!)
mv config0.m4 config.m4
$PHP_PREFIX/bin/phpize或直接/usr/local/bin/phpize
./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config
make
make test
make install

在php.ini内加入以下内容:

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
extension = "openssl.so"

重启php、nginx后生效

注意:

pcre、zlib等模块目录下也是config0.m4。

如果执行
/usr/local/bin/phpize
出现
Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
是因为openssl目录下没有把config0.m4改名为config.m4。
mv config0.m4 config.m4