MAMP下面的php添加openssl扩展

在MAMP集成开发环境下测试支付宝sdk时,总是在签名参数的地方返回空,参数格式都是正确的,是因为openssl扩展没有开。

原文地址:http://jaspan.com/openssl-support-php-under-mamp

  1. Build the PHP openssl extension (or, if you are really lazy, just download the one I built).
    Download PHP from php.net. I'm using MAMP 1.6 (haven't bothered to upgrade) which uses PHP 5.2.1 which, it turns out, does not build properly on MacOS X 10.5 Leopard. So I used PHP 5.2.5 instead which works fine; this is also the version that MAMP 1.7 uses. Newer versions of 5.2 would probably also work.
    Using Terminal, extract, configure, and build PHP, specifically requesting a shared openssl library:
 tar -xzf php-5.2.5.tar.gz
 cd php-5.2.5
 ./configure --with-openssl=shared% make
  1. Install the PHP openssl extension
    From the same directory in which you ran make:
cp modules/openssl.so /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20050922/

The date in the final directory name will depend on which version of MAMP/PHP you have installed.

  1. Edit /Applications/MAMP/conf/php5/php5.ini.
    Search for lines that contain "extension=" and add the line
extension=openssl.so

That's it!

你可能感兴趣的:(MAMP下面的php添加openssl扩展)