Configure Apache + PHP + MySQL in Mac OS X

Source: Internet
Author: User
Tags mcrypt

.This document uses Mac OS X 10.6.3 and10.8.1For example. The main content includes:


!"Page, which is located under"/Library (resource Library)/WebServer/Documents/", which is the default root directory of Apache.

.It is worth noting that when Mac OS X cancels "Web Sharing" in 10.8, the "/Users/[user name]/Sites/" directory is also removed, so 10.Access "http: // [local IP address]/~ [User name] "will display" 403 Forbidden ", but http: // [local IP address]/can still be accessed.Go to "system preference settings"> "Security"> "Firewall", enable the Firewall, and then click "Firewall Options) click block all incoming connections..You can also set httpd. conf to only allow localhost and access "/Library (resource Library)/WebServer/Documents /".

<Directory "/Library/WebServer/Documents">    ......    #    # Controls who can get stuff from this server.    #    Order allow,deny    #Allow from all    Allow from    Allow from localhost </Directory>

.5.MySQL provides installation instructions for Mac OS X.

Warning: The/usr/local/mysql/data directory is not owned by the 'mysql' or '_ mysql'", This should be caused by some circumstances/usr/local/mysql/dataThe host has changed, just run"sudo chown -R mysql /usr/local/mysql/data"..

.0.0.1. The reason is that php searches for the connection by default./var/mysql/mysql.sockBut MYSQL for MAC changed the file location and put it under/tmp..The solution is to modify php. ini as follows:

mysql.default_socket = /tmp/mysql.sock

.Using phpMyAdmin to manage MySQL is a very effective way to verify the effect of the previous steps.


.However, the installation in Mac OS X is not so friendly, as follows:

Http: // localhost/phpmyadmin"The mcrypt extension cannot be loaded. Please check your PHP configuration..The message "no" indicates that the MCrypt extension library has been successfully installed. If it cannot be loaded, try to addextensionTo:


.8 & 10.7 Development Server and Adding MCRYPT to your OSX Lion PHP install

.6.3 and 10.8.1 are supported by the Central Plains. For more information, see "Mac OS X Leopard: Configure Apache, PHP, SQLite, MySQL, and phpMyAdmin (1) "and" Mac OS X Leopard: Configure Apache, PHP, SQLite, MySQL, and phpMyAdmin (2 )".In fact, you can also use an integrated solution provided by a third party such as XAMPP or MacPorts for simple installation and use..

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: 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.