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!

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 文 / 廖玮雯 为什么对于同样的事有人能轻而易举地化解,有人却万般纠结,无法抽身呢?或者说,为什么有些人在他遇到一...
    廖玮雯阅读 7,363评论 57 301
  • 多肉植物老桩系列 柠檬贝瑞 超级喜欢它 关注多肉花客
    多肉花客阅读 2,552评论 0 0
  • 雪花轻飘飘的落着,天地间静谧,这是个寒冷的早晨。你要辞别你最爱的姐姐,千重子。 十多年来,你一直在寻找姐姐...
    子禾啊阅读 218评论 0 1
  • It is impatience I'm experiencing. Today I haven't been i...
    Maya3319阅读 379评论 0 1
  • 万般回旋流转百般滋味, 暮然回首那年相隔已远, 思绪万千怎奈往事如烟, 茫茫夜色怎掩丝丝痛感, 何来刻骨铭心永相恋...
    A雨后骄阳阅读 192评论 0 0