在OS X上安装pecl和pear 10.11 El Capitan,macOS 10.12 Sierra,macOS 10.13 High Sierra

时间:2021-05-28 07:14:07

So it looks like the new 'System Integrity Protection' lockdown of /usr (among other directories) makes pear and pecl a non-starter. Has anyone found a workaround short of disabling it?

所以看起来新的'系统完整性保护'锁定/ usr(以及其他目录)使得梨和pecl成为非首发。有没有人找到一个解决方法而不是禁用它?

6 个解决方案

#1


60  

There's a much easier way — no need to disable SIP or download your own copy:

有一种更简单的方法 - 无需禁用SIP或下载您自己的副本:

sudo php /usr/lib/php/install-pear-nozlib.phar -d /usr/local/lib/php -b /usr/local/bin

#2


38  

You shouldn't install binaries into system /usr, use /usr/local instead.

您不应该将二进制文件安装到system / usr中,而是使用/ usr / local。

You can install pear using Homebrew:

你可以使用Homebrew安装pear:

brew install php56 --with-pear

Note: If above command won't work, make sure you add the tap first by: brew tap homebrew/homebrew-php.

注意:如果上面的命令不起作用,请确保先添加点击:brew tap homebrew / homebrew-php。

Note: You can also type reinstall if you've already php56 package.

注意:如果您已经有php56包,也可以键入重新安装。

or directly downloading Phar package:

或直接下载Phar包:

curl -o /usr/local/bin/pear http://pear.php.net/go-pear.phar
chmod +x /usr/local/bin/pear

Then you should have pecl and pear binaries along with your php

然后你应该有你的PHP的pecl和梨二进制文件

If not, relink it by:

如果没有,请重新链接:

brew unlink php56 && brew link php56 --dry-run && brew link --overwrite --force php@5.6

And pecl you should have it along with php when installed via brew install php56. If not, try to link it manually:

并且当你通过brew install php56安装时,你应该将它与php一起使用。如果没有,请尝试手动链接:

ln -vs "$(find /usr/local/Cellar/php56 -name pecl -print -quit)" /usr/local/bin

#3


25  

From this link: http://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/ With this instructions, you don't need to disable 'System Integrity Protection'

从以下链接: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.

#4


0  

Here's a link to a Macworld article that describes how to enable and disable 'System Integrity Protection.'

以下是Macworld文章的链接,该文章介绍了如何启用和禁用“系统完整性保护”。

http://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html

http://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html

#5


0  

This worked for me as of MacOS Sierra 10.12.1 for upgrading PHP, installing PEAR and V8

从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

#6


0  

High Sierra setup:

High Sierra设置:

  • install Brew
  • 安装Brew
  • install PHP with Brew
  • 用Brew安装PHP

There is preinstalled PEAR PACKAGE in

有预装的PEAR PACKAGE

/usr/local/opt/php@<your_version>/bin

from there you can run

从那里你可以跑

pecl install xdebug

and you should have working PHP binary with Xdebug.

你应该使用Xdebug工作PHP二进制文件。

#1


60  

There's a much easier way — no need to disable SIP or download your own copy:

有一种更简单的方法 - 无需禁用SIP或下载您自己的副本:

sudo php /usr/lib/php/install-pear-nozlib.phar -d /usr/local/lib/php -b /usr/local/bin

#2


38  

You shouldn't install binaries into system /usr, use /usr/local instead.

您不应该将二进制文件安装到system / usr中,而是使用/ usr / local。

You can install pear using Homebrew:

你可以使用Homebrew安装pear:

brew install php56 --with-pear

Note: If above command won't work, make sure you add the tap first by: brew tap homebrew/homebrew-php.

注意:如果上面的命令不起作用,请确保先添加点击:brew tap homebrew / homebrew-php。

Note: You can also type reinstall if you've already php56 package.

注意:如果您已经有php56包,也可以键入重新安装。

or directly downloading Phar package:

或直接下载Phar包:

curl -o /usr/local/bin/pear http://pear.php.net/go-pear.phar
chmod +x /usr/local/bin/pear

Then you should have pecl and pear binaries along with your php

然后你应该有你的PHP的pecl和梨二进制文件

If not, relink it by:

如果没有,请重新链接:

brew unlink php56 && brew link php56 --dry-run && brew link --overwrite --force php@5.6

And pecl you should have it along with php when installed via brew install php56. If not, try to link it manually:

并且当你通过brew install php56安装时,你应该将它与php一起使用。如果没有,请尝试手动链接:

ln -vs "$(find /usr/local/Cellar/php56 -name pecl -print -quit)" /usr/local/bin

#3


25  

From this link: http://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/ With this instructions, you don't need to disable 'System Integrity Protection'

从以下链接: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.

#4


0  

Here's a link to a Macworld article that describes how to enable and disable 'System Integrity Protection.'

以下是Macworld文章的链接,该文章介绍了如何启用和禁用“系统完整性保护”。

http://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html

http://www.macworld.com/article/2986118/security/how-to-modify-system-integrity-protection-in-el-capitan.html

#5


0  

This worked for me as of MacOS Sierra 10.12.1 for upgrading PHP, installing PEAR and V8

从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

#6


0  

High Sierra setup:

High Sierra设置:

  • install Brew
  • 安装Brew
  • install PHP with Brew
  • 用Brew安装PHP

There is preinstalled PEAR PACKAGE in

有预装的PEAR PACKAGE

/usr/local/opt/php@<your_version>/bin

from there you can run

从那里你可以跑

pecl install xdebug

and you should have working PHP binary with Xdebug.

你应该使用Xdebug工作PHP二进制文件。