Linux-change the PHP version of Mac (osx) for help

Source: Internet
Author: User
You need to change the PHP version of Mac from 5.5 to 5. 3. first, you need to delete the built-in Version 5.5 and delete the file as follows: {code ...} note: After Apache is restarted, phpinfo () is still displayed. then use brew to install php. {code ...} next, according to the online tutorial... Change the PHP version of Mac from 5.5 to 5.3 as needed.

First, you need to delete the built-in Version 5.5 and delete the file as follows:

/private/etc/           sudo rm -rf php-fpm.conf.default php.ini php.ini.default/usr/bin/               sudo rm -rf php php-config phpdoc phpize/usr/include            sudo rm -rf php/usr/lib                sudo rm -rf php/usr/sbin               sudo rm -rf php-fpm/usr/share              sudo rm -rf php/usr/share/man/man1     sudo rm -rf php-config.1 php.1 phpize.1/usr/share/man/man8     sudo rm -rf php-fpm.8

Note: After Apache is restarted, phpinfo () is still displayed.

Then use brew to install php.

brew install php53 --with-apache

Then, the following lines of code are run according to the online tutorial:

Echo 'export PATH = "$ (brew -- prefix homebrew/php/php53)/bin: $ PATH" '>> ~ /. Bash_profile # for php echo 'export PATH = "$ (brew -- prefix homebrew/php/php53)/sbin: $ PATH" '>> ~ /. Bash_profile # for php-fpm echo 'export PATH = "/usr/local/bin:/usr/local/sbin: $ PATH" '>> ~ /. Bash_profile # for other brew install soft source ~ /. Bash_profile # Update Configuration

Then, modify the configuration file httpd. conf in apache:

LoadModule php5_module/usr/local/opt/php53/libexec/apache2/libphp5.so # originally: LoadModule php5_module libexec/apache2/libphp5.so # This new php53. so file has been determined.

After Apache is restarted, phpinfo () is not displayed.

Reply content:

Change the PHP version of Mac from 5.5 to 5.3 as needed.

First, you need to delete the built-in Version 5.5 and delete the file as follows:

/private/etc/           sudo rm -rf php-fpm.conf.default php.ini php.ini.default/usr/bin/               sudo rm -rf php php-config phpdoc phpize/usr/include            sudo rm -rf php/usr/lib                sudo rm -rf php/usr/sbin               sudo rm -rf php-fpm/usr/share              sudo rm -rf php/usr/share/man/man1     sudo rm -rf php-config.1 php.1 phpize.1/usr/share/man/man8     sudo rm -rf php-fpm.8

Note: After Apache is restarted, phpinfo () is still displayed.

Then use brew to install php.

brew install php53 --with-apache

Then, the following lines of code are run according to the online tutorial:

Echo 'export PATH = "$ (brew -- prefix homebrew/php/php53)/bin: $ PATH" '>> ~ /. Bash_profile # for php echo 'export PATH = "$ (brew -- prefix homebrew/php/php53)/sbin: $ PATH" '>> ~ /. Bash_profile # for php-fpm echo 'export PATH = "/usr/local/bin:/usr/local/sbin: $ PATH" '>> ~ /. Bash_profile # for other brew install soft source ~ /. Bash_profile # Update Configuration

Then, modify the configuration file httpd. conf in apache:

LoadModule php5_module/usr/local/opt/php53/libexec/apache2/libphp5.so # originally: LoadModule php5_module libexec/apache2/libphp5.so # This new php53. so file has been determined.

After Apache is restarted, phpinfo () is not displayed.

Step 1: first check whether the result is php5.3 in the command line php -- version.

Part 2: Check whether/usr/local/opt/php53/libexec/apache2/libphp5.so has this file.

I tried this idea when I first played OSX. Later I used Python, virtualenv, ruby rvm, and so on. We do not recommend that you use OSX for Linux.
It's time to sacrifice the powerful weapon: phpbrew

Brew follows. That's not enough. It's so annoying.

Install this directly: http://php-osx.liip.ch/

You can use nginx to run different versions, which is more convenient than apache. Of course, you can use apache to proxy different versions of php.

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.