In MAC, you can change the apache configuration file to switch to multiple php versions,

Source: Internet
Author: User

In MAC, you can change the apache configuration file to switch to multiple php versions,

Preface

Some time ago, I upgraded php on my computer. Although php7.0 has some updates, the speed has also improved a lot. However, during development recently, I found that many engines do not support php7, so I thought I could not install two versions to switch between them. Baidu found that many methods would not work. So I started my research and found that the php version is the php version that comes with mac OS when "php-v" is run on the terminal, you can change the apache configuration file to switch to the php version.

The method is as follows:

1. Find the entropy-php.conf in the/usr/local/php5 directory, open it in a text editor

LoadModule php7_module/usr/local/php5/libphp7.so

Copy the configuration and delete it.

2. Locate httpd. conf in the/etc/apache2 directory and open it in a text editor.

LoadModule php5_module libexec/apache2/libphp5.so

Remove the previous #, paste the copied configuration in the next line, and annotate it.

For example:

LoadModule php5_module libexec/apache2/libphp5.so # LoadModule php7_module/usr/local/php5/libphp7.so

Then run the command in the terminal.

Sudo apachectl restart

Restart apache and use phpinfo to test the php version. You will find that the php version has been switched to php5!

Summary

The above is all the content of this article. I hope the content of this article will help you in your study or work. If you have any questions, please leave a message, thank you for your support.

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.