Installation de pecl et pear sur OS X 10.11 El Capitan, macOS 10.12 Sierra, macOS 10.13 High Sierra

Il semble donc que le nouveau locking de / usr de la protection de l’intégrité du système (parmi d’autres répertoires) fait de Pear et Pecl un élément non-starter. Quelqu’un at-il trouvé une solution de rechange pour le désactiver?

Il existe un moyen beaucoup plus simple: pas besoin de désactiver SIP ou de télécharger votre propre copie:

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

Vous ne devez pas installer de fichiers binarys dans system /usr , utilisez plutôt /usr/local .


Les commandes pecl et pear doivent accompagner PHP lors de l’installation via Homebrew .

Voici l’exemple d’installation de PHP avec le dernier Homebrew:

 brew install [email protected] 

ou l’ancienne version:

 brew install [email protected] 

Pour trouver vos commandes pecl et pear , lancez:

 find -L "$(brew --prefix [email protected])" -name pecl -o -name pear 

Si vous n’en avez pas, envisagez de désinstaller la version précédente de PHP ou d’exécuter la reinstall place.

Vous pouvez également essayer de le relier par:

 brew unlink [email protected] && brew link [email protected] --dry-run && brew link --overwrite --force [email protected] 

Sinon , liez-le manuellement:

 ln -vs "$(find -L "$(brew --prefix [email protected])/bin" -name pecl)" /usr/local/bin ln -vs "$(find -L "$(brew --prefix [email protected])/bin" -name pear)" /usr/local/bin 

Vous pouvez également télécharger Pear directement sous forme de package Phar:

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

ou avec ce one-liner suivant (fonctionnera sous Linux, mais pas sous Unix):

 install -v -m755 <(curl -sL http://pear.php.net/go-pear.phar) /usr/local/bin/pear 

A partir de ce lien: http://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/ Avec ces instructions, vous n’avez pas besoin de désactiver ‘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 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. 

Ajouter le suffixe --with-pear pour installer poire et pecl
Voir exemple ci-dessous

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

Voici un lien vers un article Macworld qui explique comment activer et désactiver la protection de l’intégrité du système.

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

Cela a fonctionné pour moi à partir de MacOS Sierra 10.12.1 pour mettre à jour PHP, en installant PEAR et 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 

Configuration High Sierra:

  • installer Brew
  • installer PHP avec Brew

Il y a un PEAR PACKAGE préinstallé dans

 /usr/local/opt/php@/bin 

de là vous pouvez courir

 pecl install xdebug 

et vous devriez avoir du binary PHP avec Xdebug.