Configure the Apache + PHP + Mysql environment in MacOS

Source: Internet
Author: User
Apache + PHP + Mysql is the standard for PHP development. The EasyPHP integration package can be installed in Windows. The Mac system also has the corresponding integration package MAMP. However, considering that MacOS already comes with the Apache and PHP environments, it is redundant to install Apache and PHP repeatedly. This article describes how to use homebrew to install Mysql and integrate the original Apache and PHP environments. Qi

Apache + PHP + Mysql is the standard for PHP development. The EasyPHP integration package can be installed in Windows. The Mac system also has the corresponding integration package MAMP. However, considering that Mac OS already comes with the Apache and PHP environments, installing Apache and PHP is redundant. This article describes how to install Mysql using homebrew and integrate the original Apache and PHP environments. Qi

Apache + PHP + Mysql is the standard for PHP development. The EasyPHP integration package can be installed in Windows. The Mac system also has the corresponding integration package MAMP. However, considering that Mac OS already comes with the Apache and PHP environments, installing Apache and PHP is redundant. This article describes how to install Mysql using homebrew and integrate the original Apache and PHP environments.

Start Apache

Open Terminal and run

sudo apachectl start

View the Apache version of Mac OS X

sudo apachectl -v

The returned result of Mac OS X 10.9 is

Server version: Apache/2.2.24 (Unix)
Server built: Aug 24 2013 21:10:43

Enterhttp://localhostYou can see that the content is "It works !" Page, which is located in/Library/WebServer/Documents/Which is the default root directory of Apache.

In addition, you canHttp: // [local IP address]/~ [User name]To access/Users/[user name]/Sites/Directory

Enable PHP support
  1. Run in Terminalsudo vi /etc/apache2/httpd.confOpen the Apache configuration file.
  2. Find#LoadModule php5_module libexec/apache2/libphp5.so, Remove the # sign, save it (enter w in the command line), and exit vi (enter q in the command line ).
  3. Runsudo cp /etc/php.ini.default /etc/php.iniIn this way, you can runsudo vi /etc/php.iniTo edit php. ini configuration features. For example:

    ; Use the following two items to adjust the maximum value of the PHP submitted file, for example, the maximum value of data imported in phpMyAdmin upload_max_filesize = 2 M post_max_size = 8 M; display_errors is used to control whether to display the error message of the PHP program, which is very useful when debugging the PHP program display_errors = Off.

  4. Run "sudo apachectl restart" and restart Apache so that PHP can be used.
Install Xdebug
  1. Run on the terminalphp -i | pbcopy, Php output information will be copied to the clipboard.
  2. Open the xdebug online Installation Wizard, in the text box Command + V, copy the content in the clipboard to the text box, and then click the "Analyse my phpinfo () output" button.
  3. Install the SDK according to the generated steps.
Install Mysql

This step is the easiest, provided that HomeBrew is installed. Execute

brew install mysql

After the installation is complete, start the mysql Service

mysql.server start
Read more
  1. Configure Apache + PHP + MySQL in Mac OS X

Original article address: configure the Apache + PHP + Mysql environment in Mac OS. Thank you for sharing it with me.

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.