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.