Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to downgrade php7 to php5.6 in mac high sierra

Tags:

php

Have a zend file which is perfectly go over php5.x but when it move with mac high sierra where getting error , I found that there is php 7 so want to downgrade 7 to 5.6

like image 796
Robin Avatar asked Jan 20 '18 06:01

Robin


People also ask

How do I uninstall PHP on Mac?

How do I uninstall PHP on Mac? Click Finder and tap on the Applications category. Select PHP and drag it to the Trash icon or you can also right-click on it and click Move to Trash. Now, right-click on the Trash icon again and select Empty Trash.

How do I find PHP version on Mac?

Open a bash shell terminal and use the command “php –version” or “php -v” to get the version of PHP installed on the system.


1 Answers

1) On the Terminal:

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6

2) Then, open the file /etc/apache2/httpd.conf with read/write permissions and change the following lines:

Change the line:

LoadModule php7_module libexec/apache2/libphp7.so

To that:

#LoadModule php7_module libexec/apache2/libphp7.so
LoadModule php5_module /usr/local/php5/libphp5.so
<IfModule mod_php5.c>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    <IfModule mod_dir.c>
        DirectoryIndex index.html index.php
    </IfModule>
</IfModule>

3) Pay attention because when you upgraded your macOS Sierra to macOS Sierra High, in apache2 folder, the previous file http.conf still in there but with another name. You can see and compare both for a correct configuration of your PHP 5.6. Usually, the line DocumentRoot, <Directory "/some_local/"> and LoadModule were changed by the macOS upgrade, just compare what you had and change that according to you'd like the Apache/PHP behaves.

4) Restart your apache:

On the Terminal again, type it: sudo /usr/sbin/apachectl restart

like image 117
Claudio Guirunas Avatar answered Oct 04 '22 21:10

Claudio Guirunas