search

Home  >  Q&A  >  body text

laravel - osx terminal switches php-cli version

I want to learn about Laravel recently

When executing composer update, error:mcrypt required

will be prompted.

After investigation, the PHP version of localhost is 5.6.2

Enter php -v in the terminal and the version displayed is 5.5.14

It is estimated that the problem is caused by different php versions

The osx used by localhost comes with apache and php

I have used brew to upgrade the php version before

Terminal use zsh

Execute the command in the terminal:

php -v get php 5.5.14

/usr/bin/php -v get php 5.5.14

/usr/local/php5/bin/php -v get php 5.6.2

I want to switch the terminal to php 5.6.2 version to install Laravel

How to switch the php version in the osx terminal to make it consistent with the environment version

Thank you so much~~~~(>_<)~~~~

为情所困为情所困2751 days ago499

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-16 16:58:45

    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"
    

    reply
    0
  • Cancelreply