brew 安装 PHP54 失败

今天使用brew安装PHP54,结果发现出现如下错误:

  1. TCRMBP➜  Homebrew  brew install php54
  2. ==> Installing php54 from homebrew/homebrew-php
  3. ==> Downloading http://www.php.net/get/php-5.4.33.tar.bz2/from/this/mirror
  4. Already downloaded: /Users/charles/Library/Caches/Homebrew/php54-5.4.33
  5. ==> ./configure --prefix=/usr/local/Cellar/php54/5.4.33 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.4 --with-config-fi
  6. checking for krb5-config... /usr/bin/krb5-config
  7. checking for DSA_get_default_method in -lssl... no
  8. checking for X509_free in -lcrypto... yes
  9. checking for pkg-config... no
  10. configure: error: Cannot find OpenSSL's <evp.h>
  11.  
  12. READ THIS: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Troubleshooting.md#troubleshooting
  13. If reporting this issue please do so at (not Homebrew/homebrew):
  14.   https://github.com/homebrew/homebrew-php/issues
  15.  
  16. /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:119:in <code>error!': 400 "Bad Request" (Net::HTTPServerException)
  17. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http/response.rb:128:in </code>value'
  18. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:913:in <code>connect'
  19. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:862:in </code>do_start'
  20. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:851:in <code>start'
  21. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:313:in </code>open_http'
  22. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:709:in <code>buffer_open'
  23. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:210:in </code>block in open_loop'
  24. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:208:in <code>catch'
  25. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:208:in </code>open_loop'
  26. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:149:in <code>open_uri'
  27. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:689:in </code>open'
  28. from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:30:in <code>open'
  29. from /usr/local/Library/Homebrew/utils.rb:323:in </code>open'
  30. from /usr/local/Library/Homebrew/utils.rb:355:in <code>issues_matching'
  31. from /usr/local/Library/Homebrew/utils.rb:383:in </code>issues_for_formula'
  32. from /usr/local/Library/Homebrew/exceptions.rb:147:in <code>fetch_issues'
  33. from /usr/local/Library/Homebrew/exceptions.rb:143:in </code>issues'
  34. from /usr/local/Library/Homebrew/exceptions.rb:182:in <code>dump'
  35. from /usr/local/Library/brew.rb:163:in </code>rescue in <main>'
  36. from /usr/local/Library/brew.rb:66:in `<main>'

这个东西怎么造成的呢,其实MacOS系统升级Yosemite后,系统include目录又没了,执行如下命令即可修复这个问题:

  1. sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include /usr/include

这个命令是把XCode目录下的include文件给链接到 /usr/include,其实很多configure错误,都可能是这个造成的。如果安装别的失败也可以这么试试。