首页 > osx终端切换php-cli版本

osx终端切换php-cli版本

最近想要了解Laravel

在执行composer update的时候会提示error:mcrypt required

经过排查之后,localhost的php版本为5.6.2

终端输入php -v 版本显示是5.5.14

估计是php版本不同引起的问题

localhost使用的osx自带apache和php

之前使用brew升级过php版本

终端使用zsh

在终端执行命令:

php -v 得到 php 5.5.14

/usr/bin/php -v 得到 php 5.5.14

/usr/local/php5/bin/php -v 得到 php 5.6.2

我想要终端切换到php 5.6.2版本来安装Laravel

请问如何在osx终端切换php版本,使其与环境版本一致

不胜感激涕零~~~~(>_<)~~~~


brew info php55

底下有一块讲到这个:

✩✩✩✩ PHP CLI ✩✩✩✩

If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc,
~/.zshrc, ~/.profile or your shell's equivalent configuration file:

  export PATH="$(brew --prefix homebrew/php/php55)/bin:$PATH"
【热门文章】
【热门文章】