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

所以它看起来像新的'系统完整性保护'锁定使梨和pecl成为非 起动机。 有没有人找到一个解决方法而不是禁用它? </ p>
</ div>

展开原文

原文

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?

dpvm7231
dpvm7231 你如何禁用和启用它?
接近 5 年之前 回复
dongshuo2752
dongshuo2752 最后,我禁用了它,做了我需要做的事情,然后重新启用它。
接近 5 年之前 回复

10个回答



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

   sudo php /usr/lib/php/install-pear-nozlib.phar -d / usr / local / lib / php -b / usr / local / bin 
</ code> </ pre>
< / DIV>

展开原文

原文

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

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

doujumiao5024
doujumiao5024 这应该工作curl -s -O https://pear.php.net/install-pear-nozlib.pharsudo php install-pear-nozlib.phar -d / usr / local / lib / php -b / usr / local /箱
大约一年之前 回复
duandang6352
duandang6352 也不适用于Mohave:无法打开输入文件:/usr/lib/php/install-pear-nozlib.phar
一年多之前 回复
dtz88967
dtz88967 这不适用于macOS High Sierra版本10.13.3无法打开输入文件:/usr/lib/php/install-pear-nozlib.phar
大约 2 年之前 回复
dpjpo746884
dpjpo746884 这些是命令行标志,指定(a)PHP二进制文件的路径和(b)应安装pear的路径。
2 年多之前 回复
dtpyvb1873
dtpyvb1873 什么是-d和-b? 它们是用于PHP的phar文件的密钥吗?
2 年多之前 回复
dongqiabei7682
dongqiabei7682 这是一个很好的答案!
3 年多之前 回复
dongshen5115
dongshen5115 工作正常:-)
3 年多之前 回复
douzhenchun6782
douzhenchun6782 约翰:试试这个stackoverflow.com/questions/26584599 / ...
3 年多之前 回复
douzhao1912
douzhao1912 这很棒! 但是当我尝试使用sudo pecl install安装扩展时,我得到:错误:写入/ usr / lib / php / extensions / ...无法解决这个问题?
3 年多之前 回复
dtbglv5450
dtbglv5450 花了一段时间才接受,因为我不再需要这个,直到我安装塞拉并重新整理了我的整个LAMP堆栈(再次)。
3 年多之前 回复
doubeng1278
doubeng1278 凉!! 这应该标记为答案
接近 4 年之前 回复
dtq81142
dtq81142 这适用于OSX El Capitan(10.11.4),谢谢!
大约 4 年之前 回复



On Mohave我必须运行以下命令 - 感谢 https://tobschall.de/2018/08/07/pear-on-mojave/ </ p>

< pre> cd / tmp
curl -s -O https://pear.php.net/install-pear-nozlib.phar
sudo php install-pear-nozlib.phar -d / usr / local / lib / php -b / usr / local / bin
</ code> </ pre>
</ div>

展开原文

原文

On Mohave I had to run the following commands - thanks go to https://tobschall.de/2018/08/07/pear-on-mojave/

cd /tmp
curl -s -O https://pear.php.net/install-pear-nozlib.phar
sudo php install-pear-nozlib.phar -d /usr/local/lib/php -b /usr/local/bin



添加后缀 - with-pear </ code>以安装pear和pecl

请参阅下面的示例</ p>

  brew install php --with-pear 
brew重新安装php --with-pear
</ code> </ pre>
</ div>

展开原文

原文

Add suffix --with-pear to install pear and pecl
See example below

brew install php --with-pear
brew reinstall php --with-pear

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


The pecl and pear commands should come along with PHP when installing via Homebrew.

Here is the example installing PHP with the latest Homebrew:

brew install php

or the specific version:

brew install php@7.1
brew install php@5.6

To find your pecl and pear commands, run:

find -L "$(brew --prefix php)" -name pecl -o -name pear

or:

find -L "$(brew --prefix php@7.1)" -name pecl -o -name pear

If you don't have it, consider uninstalling previous PHP version or run reinstall instead.

You can also try to relink it by:

brew unlink php@7.1 && brew link php@7.1 --dry-run && brew link --overwrite --force php@7.1

Otherwise, link it manually:

ln -vs "$(find -L "$(brew --prefix php@7.1)/bin" -name pecl)" /usr/local/bin
ln -vs "$(find -L "$(brew --prefix php@7.1)/bin" -name pear)" /usr/local/bin

Alternatively download Pear it directly as a Phar package:

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

or with this following one-liner (will work on Linux, but not on Unix):

curl -sL http://pear.php.net/go-pear.phar | sudo install -v -m755 /dev/stdin /usr/local/bin/pear
duanliaogui4133
duanliaogui4133 --with-pear不再有效
接近 2 年之前 回复
duanjigua5753
duanjigua5753 我不得不使用brew unlink php56 && brew链接php56 --dry-run && brew链接--overwrite php@5.6 --force以使其工作,我有一个较旧的PHP 5.5安装,有一些冲突。
接近 2 年之前 回复
duanjian7343
duanjian7343 这必须是公认的答案。
大约 3 年之前 回复
doulu6314
doulu6314 谢谢你的好评。 使用--with-pear安装PHP应正确安装pear(在/ usr / local / opt / php56 / bin / pear中)。 然后brew链接php56将其二进制文件链接到/ usr / local / bin / pear。
大约 4 年之前 回复



从此链接: http://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/ 通过本说明,您 不需要禁用“系统完整性保护”</ p>


以下说明在
/ usr / local / <下的Mac OS X上安装PEAR和PECL / strong>即可。 PECL与PEAR捆绑在一起。 所以这就像在Mac OS X上安装PEAR一样简单。</ p>

PEAR是PHP的Package Repository,可以轻松下载和安装PHP工具,如PHPUnit和XDebug。 我特别为每个PHP开发人员推荐这两个。</ p>

下载PEAR </ h2>

  curl -O https://pear.php。  net / go-pear.phar 
sudo php -d detect_unicode = 0 go-pear.phar
</ code> </ pre>

配置和安装PEAR </ h2>

< p>您现在应该提示配置PEAR。</ p>


  1. 键入 1 </ kbd>并按 return </ kbd>。< / li>
  2. 输入:</ p>

      / usr / local / pear 
    </ code> </ pre> </ li>
    < li>

    键入 4 </ kbd>并按 return </ kbd>。</ p> </ li>

  3. 输入:</ p>
    \ n

      / usr / local / bin 
    </ code> </ pre> </ li>
  4. return </ kbd> </ p> </ li>
    </ ol>

    验证PEAR。</ h2>

  5. 您应该能够输入:</ p>

       pear version 
    </ code> </ pre>

    最后,如果你使用PEAR的任何扩展或应用程序,你可能需要更新PHP的包含路径。</ p>
    </ blockquote>
    </ div>

展开原文

原文

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'

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 https://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.

  1. Type 1 and press return.
  2. Enter:

    /usr/local/pear
    
  3. Type 4 and press return.

  4. Enter:

    /usr/local/bin
    
  5. 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文章的链接,该文章介绍了如何启用和禁用“系统完整性保护”。</ p>

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

展开原文

原文

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

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

This worked for me as of MacOS Sierra 10.12.1 for upgrading PHP, installing PEAR and 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 "
export PATH=$HOME/pear/bin:$PATH 
"

source ~/.bash_profile

echo -e "
include_path = '.:/Users/YOURUSERNAME/pear/share/pear/' 
extension=v8js.so 
" >> /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

High Sierra setup:

  • install Brew
  • install PHP with Brew

There is preinstalled PEAR PACKAGE in

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

from there you can run

pecl install xdebug

and you should have working PHP binary with Xdebug.

duanlang1196
duanlang1196 我知道它可能已经很晚了但您可以使用以下语法从同一文件夹启动脚本文件./pecl install xdebug。 我希望它可以帮助别人。
一年多之前 回复
duanjiu1950
duanjiu1950 -bash:pecl:找不到命令
大约 2 年之前 回复



当使用brew并且未链接时,请使用:</ p>

  brew install php @  5.6 
brew unlink php@5.6

$(brew --prefix php@5.6)/ bin / pecl
$(brew --prefix php@5.6)/ bin / pear
</ code> </ pre >
</ div>

展开原文

原文

When brew is used and not linked, use:

brew install php@5.6
brew unlink php@5.6

$(brew --prefix php@5.6)/bin/pecl
$(brew --prefix php@5.6)/bin/pear



对于macOS Mojave 10.14.4,当被要求提供“安装基础($ prefix)”位置时,只需使用/ local而不是/ usr。 / p>
</ div>

展开原文

原文

For macOS Mojave 10.14.4 just use /local instead of /usr when asked for "Installation base ($prefix)" location.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问