在OS X 10.11上安装pecl和pear El Capitan或macOS 10.12 Sierra
所以看起来像/ usr(其他目录)的新“系统完整性保护” locking使得pear和pecl成为非启动器。 有没有人发现一个解决方法不能禁用它?
有一个更简单的方法 – 不需要禁用SIP或下载自己的副本:
sudo php /usr/lib/php/install-pear-nozlib.phar -d /usr/local/lib/php -b /usr/local/bin
您不应该将二进制文件安装到/usr
系统中,而是使用/usr/local
。
你可以使用Homebrew安装pear
:
brew install php56 --with-pear
运行reinstall
而不是如果你已经php56
包。
或者直接下载Phar包:
curl -o /usr/local/bin/pear http://pear.php.net/go-pear.phar chmod +x /usr/local/bin/pear
那么你应该有你的php
一起pecl
和pear
二进制文件
如果没有,请通过以下方式重新链接
brew unlink php56 && brew link php56 --dry-run && brew link php56
pecl
你应该有它与php
一起安装通过brew install php56
。 如果不是 ,请尝试手动链接它:
ln -vs "$(find /usr/local/Cellar/php56 -name pecl -print -quit)" /usr/local/bin
从这个链接: http : //jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/有了这个指示,你不需要禁用“系统完整性保护”
The following instructions install PEAR and PECL on Mac OS X under /usr/local/. PECL is bundled with PEAR. So this is as simple as installing PEAR on Mac OS X. PEAR is PHP's Package Repository and makes it easy to download and install PHP tools like PHPUnit and XDebug. I specifically recommend these two for every PHP developer. Download PEAR curl -O http://pear.php.net/go-pear.phar sudo php -d detect_unicode=0 go-pear.phar Configure and Install PEAR You should now be at a prompt to configure PEAR. Type 1 and press return. Enter: /usr/local/pear Type 4 and press return. Enter: /usr/local/bin Press return Verify PEAR. You should be able to type: pear version Eventually, if you use any extensions or applications from PEAR, you may need to update PHP's include path.
以下是Macworld文章的链接,介绍如何启用和禁用“系统完整性保护”。
这对于MacOS Sierra 10.12.1来说,对于升级PHP,安装PEAR和V8是非常有用的
brew tap homebrew/dupes brew tap homebrew/versions brew tap homebrew/homebrew-php phpversion="$(php -v | tail -r | tail -n 1 | cut -d " " -f 2 | cut -c 1,3)" brew unlink php$phpversion brew install php71 brew install autoconf curl -O http://pear.php.net/go-pear.phar php -d detect_unicode=0 go-pear.phar echo -e "\nexport PATH=$HOME/pear/bin:$PATH \n" source ~/.bash_profile echo -e "\ninclude_path = '.:/Users/YOURUSERNAME/pear/share/pear/' \nextension=v8js.so \n" >> /usr/local/etc/php/7.1/php.ini git clone https://github.com/phpv8/v8js ~/tmp/v8js && cd $_ ./configure CXXFLAGS="-Wno-c++11-narrowing" make make test make install sudo apachectl restart