dsa2c2255888 2017-08-04 03:32
浏览 185

如何在MAC OS中将PHP一个版本切换到另一个版本?

I have installed php7.1 using homebrew in mac. But when i try php -version it shows 5.5. How can I switch version. I could not find my php instalation directory for php7.1 to set the path at bash_profile.

#brew install php71
Warning: homebrew/php/php71 7.1.7_19 is already installed

#php --version
PHP 5.5.30 (cli) (built: Oct 23 2015 17:21:45) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

Edit

I see my php installtion directory is under /usr/local/etc/php/7.1 But it contains only php.ini and pear.conf files.

I tried

export PATH="$(brew --prefix homebrew/php/php71)/bin:$PATH" But it didn't change my php version.( i tried php --version, still shows 5.5)

  • 写回答

1条回答 默认 最新

  • dpkiubcc265650 2017-08-04 12:24
    关注

    I had the same issue, this guide helped me upgrade:

    Make sure brew is up to date:

    brew update
    brew upgrade
    

    (I kinda helped make that update happen! Woo!)

    If you’re not already running php7 then you may need:

    brew tap homebrew/dupes
    brew tap homebrew/versions
    brew tap homebrew/homebrew-php
    

    And then the complicated part:

    brew unlink php70 # or  brew unlink php55
    brew install php71
    

    And the result?

    $ php --version
    PHP 7.1.0 (cli) (built: Dec  2 2016 03:30:24) ( NTS )
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
    

    Woohoo!

    评论

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码