Updating php version on mac

后端 未结 8 1583
旧巷少年郎
旧巷少年郎 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 04:40

    Use Homebrew:

    I would probably recommend installing homebrew to manage such installations for you. With that installed you can just run the following command to install php7.1

    brew update
    brew install php@71
    
    0 讨论(0)
  • 2020-12-15 04:43

    Try to use below command

    brew update brew upgrade php or brew reinstall php

    0 讨论(0)
  • 2020-12-15 04:55

    try to use the command, its working fine with me

    curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3
    
    0 讨论(0)
  • 2020-12-15 04:55

    In case you guys run all install commands above but when checking the PHP version, it is still linking to the old version. So you guys may want to update the PATH.

    In my case, I open the .bash_profile which located in HOME directory by command:

    nano ~/.bash_profile
    

    Then, I add the path to the new version of PHP:

    PATH=/usr/local/Cellar/php/7.4.4/bin:<other_paths>
    

    Finally, run source ~/.bash_profile command to refresh the terminal window and checking the PHP version again.

    Hope this helps.

    0 讨论(0)
  • 2020-12-15 05:01

    You can brew upgrade php7 or brew uninstall old php version.

    Last, I recommend you brew install php-version, php-version can help you change your php version

    0 讨论(0)
  • 2020-12-15 05:02

    Install php

    brew install php@7.2
    

    Install the required PHP to your PATH

    echo 'export PATH="/usr/local/opt/php@7.2/bin:$PATH"' >> ~/.bash_profile
    echo 'export PATH="/usr/local/opt/php@7.2/sbin:$PATH"' >> ~/.bash_profile
    source ~/.bash_profile
    

    Then make sure it's all working

    php -v
    php --version
    

    This command will show you where your ini file is loaded

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