Mac OS X enable Apache and PHP

Source: Internet
Author: User

Mac OS X comes with Apache and PHP, but is not turned on by default, this article explains how to enable both services, the environment is based on MAC OS x 10.6 Snow Leopard.

Launch Apache

The command line method is to open the terminal, the Apache service requires root permission to start, so execute the following command:
sudo apachectl start

Enable PHP

Modify the Apache configuration file, the path is/etc/apache2/httpd.conf, remove the comment (#) about the line of PHP:
LoadModule Php5_module libexec/apache2/libphp5.so
Then restart Apache:
sudo apachectl restart

Now visit the website of this machine try: http://localhost/

The default Web site root directory is/library/webserver/documents, in this directory a PHP file (so info.php) to test PHP, the file content is as simple as:

Visit this page http://localhost/info.php

The configuration information of the real PHP

Mac OS X enable Apache and PHP

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.