Installing pecl and pear on OS X 10.11 El Capitan, macOS 10.12 Sierra, macOS 10.13 High Sierra (< 10.13.3)

前端 未结 9 1839
孤城傲影
孤城傲影 2020-12-02 09:38

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

9条回答
  •  臣服心动
    2020-12-02 10:14

    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 "\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
    

提交回复
热议问题