直接用系统的php包,会导致无法解释的问题。所以需要自己下载新的php版本。
mac中我们当然就用homebrew了。
在brew之前先进行下update
brew update
但不幸的是,brew崩溃了。出现了类似的log。反复brew update也无果
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mach (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/global.rb:3:in `'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/brew.rb:15:in `'
于是求助网络,找到了解决方案。
这是homebrew的一个bug。需要执行如下操作。
sudo chown -R $(whoami):admin /usr/local
cd $(brew --prefix) && git fetch origin && git reset --hard origin/master
完事儿之后,
brew update
完后就可以安装php了
brew install php56
好了,齐活!
网友评论