Preface
I have encountered a problem in my work recently. I need to install multiple php on the Mac system and realize free switching. I found a solution by looking for relevant information. So I thought about summarizing it up to facilitate everyone to learn and refer to it. I won’t say much below, let’s take a look at the introduction.
1. Install multiple versions of php
$ brew install php54 $ brew install php70
If the installation reports the following error:
Error: Cannot install homebrew/php/php70 because conflicting formulae are installed. php54: because different php versions install the same binaries. Please `brew unlink php54` before continuing.
There are two solutions:
1、brew unlink php54
2. Delete /usr/local/bin, the following soft links about php
The above two methods have the same purpose.
2. Install the switch tool php-version
$ brew install php-version $ source $(brew --prefix php-version)/ $ php-version 5.4.45 * 7.0.17 $ php-version 5.4.45 //Switch to 5.4$ php-version * 5.4.45 7.0.17 $ echo "source $(brew --prefix php-version)/" >> ~/.bash_profile
Summarize
The above is the entire content of this article. I hope the content of this article will be of some help to your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support.