System Overview
1. Launch Apache (default integration in Mac, open service directly)
Open Terminal, enter:
sudo apachectl start
Open the browser and enter:
http: //localhost
You should see "It works!" Page, which is located in the/library/webserver/documents/directory, which is the default root directory of Apache (which can be changed to its own directory, or to a virtual directory).
2. Open PHP
In the terminal, enter:
cd/etc/apache2/
sudo vi httpd.conf
In VI, enter/php to search for text containing PHP and find:
#LoadModule Php5_module libexec/apache2/libphp5.so
Delete the previous # and then save the exit. (Press Shift+i to enter, press ESC to exit edit, press X to delete the current character, and #, enter: Wq, save and exit.) )
In Terminal input:
Codebitstream Vera sans mono ', ' Courier New ', courier,monospace!important; Min-height:inherit!important "> cd/etc
sudo cp php.ini. default php.ini
sudo apachectl restart
3. Test PHP
VI index.php
Then enter the following in the info.php:
< html >< body >< H1 > helloworld! H1> php phpinfo (); ?> body> html>
In the browser input:
127.0.0.1 can appear helloword and PHP information
4. Common errors
A. The httpd.conf cannot be opened because of a modified error 127.0.0.1 first detect the Hosts file;
B. After confirming that there is no problem, find the httpd.conf~previous replacement in the current directory, or find a colleague to pass httpd a copy to cover.
c. Test php file does not execute PHP script: Test file suffix name. html to. php
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The above describes the Mac OS X 1010 configuration Apache + PHP, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.