Updating php version on mac

后端 未结 8 1584
旧巷少年郎
旧巷少年郎 2020-12-15 04:21

I want to update php version, currently I have 5.5.38 and I want 7.1

What I tried so far is using this command:

curl -s https://php-osx.liip.ch/insta         


        
相关标签:
8条回答
  • 2020-12-15 05:02

    The simplest way to update the version of php on Mac is via Homebrew.

    If you do not have brew please visit https://brew.sh/ or install via command in terminal:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    When finished installing Homebrew, run the following commands:

    brew update && brew upgrade
    brew tap homebrew/dupes
    brew tap homebrew/versions
    brew tap homebrew/homebrew-php
    brew unlink php@56  
    brew install php@71
    

    You might get an error if PHP 5.6 has not been installed by brew previously, but don't worry, you can simply continue.

    You can also change the version to 7.0 by replacing the command from above commands from brew install php@71 to brew install php@70.

    You can check the output by command.

    php -v
    

    If the output of php -v still doesn’t echoes the version 7, simply type this command and hit enter in terminal.

    export PATH=/usr/local/php5/bin:$PATH
    
    0 讨论(0)
  • 2020-12-15 05:02

    Try to use below command

    brew update brew install php@72

    If it shows below error,

    "Error: No available formula with the name "php"

    try

    brew install php@7.2

    0 讨论(0)
提交回复
热议问题