Configuring Apache + PHP in Mac OS X 1010

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

  • Related Article

    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.