: This article describes how to configure Apache + PHP in MacOSX1010. For more information about PHP tutorials, see. System Overview
1. start Apache (it has been integrated by default in mac, and you can directly enable the service)
Open the terminal and enter:
Sudo apachectl start
Open your browser and enter:
Http: // Localhost
We should see It works! "Page, which is located in the/Library/WebServer/Documents/Directory. this is the default root directory of Apache (you can change it to your own directory or create a virtual directory ).
2. enable php
Enter:
Cd/etc/apache2/
Sudo vi httpd. conf
In vi, enter/php to search for the text containing php and find:
# LoadModule php5_module libexec/apache2/libphp5.so
Delete the previous # and save and exit. (Press shift + I to enter the first line, press ESC to exit the editing, press x to delete the current character, and press #. enter wq to save and exit .)
Enter at the terminal:
Cd/etc
Sudo cp php. ini. Default Php. ini
Sudo apachectl restart
3. test php
Vi index. php
Enter the following content in info. php:
HelloWorld!
Enter in the browser:
The HelloWord and php information can be displayed at 127.0.0.1.
4. common errors
A. Because of the incorrect httpd. conf modification, you cannot open 127.0.0.1. First, check the hosts file;
B. after confirming that no problem exists, find httpd. conf ~ in the current directory ~ Replace previous, or contact a colleague to copy httpd and overwrite it.
C. test the php file without executing the php script: change the test file suffix .html to. php.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above describes how to configure Apache + PHP in Mac OS x 1010, including some content. I hope to help some friends who are interested in PHP tutorials.