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://localhost
You 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
- Run in Terminal
sudo vi /etc/apache2/httpd.conf
Open the Apache configuration file.
- 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 ).
Runsudo cp /etc/php.ini.default /etc/php.ini
In this way, you can runsudo vi /etc/php.ini
To 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.
- Run "sudo apachectl restart" and restart Apache so that PHP can be used.
Install Xdebug
- Run on the terminal
php -i | pbcopy
, Php output information will be copied to the clipboard.
- 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.
- 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
- 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.