PHP version switching instance on Mac

Source: Internet
Author: User
Tags install brew php development environment php software phpinfo
MAC Environment to complete the switch between PHP versions, many times in local development we need multiple versions of the PHP development environment. Partners who are used to developing their own computers in the company are often forced to replace the PHP version with the company's online environment. But there is no need to reduce their PHP version, because I want to learn the latest PHP version of the new features. OK, so here's what we're going to do to solve the actual application problem:

The first thing we need to understand is the PHP software and PHP services two concepts:

    • In the terminal operation we use the PHP software

    • The PHP service is used by the client to access through the Web server

Here we understand the two concepts above using different versions of the configuration.

First of all, we are using the Mac software management tools Brew, I believe this Mac small partners are not unfamiliar (to the novice a install brew address: https://brew.sh can switch language)

We first through the terminal my client view PHP version, the display is the PHP software version:

View the PHP version via browser phpinfo (), which shows the PHP service version:

Now I'm using brew to stop php5.6 service

Brew Services Stop PHP56

Open the php7.0 server

Brew Services Start PHP70

We will check the PHP version through the terminal my client, which shows the PHP software version:

Then view the PHP version via browser phpinfo (), which shows the PHP service version:

Stop the PHP56 server, start the PHP70 service, the system version or the Php5.6,phpinfo () is already the php7.0 version

So, how to switch the System software PHP version, this is more simple, through the brew remove php5.6 soft link, add php7.0 soft link, the command line is as follows:

Brew Unlink Php56

Unlinking/usr/local/cellar/php56/5.6.33_9 ... Symlinks removed

Brew Link Php70

Linking/usr/local/cellar/php70/7.0.27_19 ... Symlinks created

Finally, we will see the PHP version through the terminal my client, which shows the PHP software version:

OK, so that we can successfully complete the PHP software and service switch!

Related recommendations:

CENTOS7 upgrade PHP version to PHP7 instance sharing

Mac Switch PHP version method

Mac OS quick way to switch multiple PHP versions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.