Configure Apache + PHP in MacOSX1010

Source: Internet
Author: User
: 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.

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.