Mac OSX 10.9.4 Mavericks enable system Apache, PHP service

Source: Internet
Author: User

As we all know, Mac OSX has built-in Apache HTTP server and PHP, with a simple configuration to use the PHP environment, local testing is very good.

1. Enable Apache Http Server ( sudo apachectl start)

Remember the following command:

Open Terminal (Terminal) input: sudo apachectl start//start service sudo apachectl stop//Turn off service sudo apachectl restart//Restart service
The above command allows the system to bring Apache server to work. Then in the browser input: http://localhost/

After you start the service, you can see "It works!", which indicates that the boot was successful. it corresponds to the path as shown:

The IT works! you saw just now is the content in the index file, where you create a new test file login.html (requires authorization), through the address bar: Http://localhost/login can be brushed out the page as follows:

Description starts Apache successfully.

2. Enable PHP

Next we start PHP service, 10.9.4 default is not open PHP, before starting PHP can test whether it has been started. Deciding whether to enable it is just to see if you can parse the PHP file.

Create a new test.php file under Repository/webserver/documents/write a simple sentence:

<?phpecho phpinfo ();
The access discovery outputs the following results:

Output as is, the description has not been parsed, stating that the PHP parsing service was not started.

So let's open it up, it's simple, just use the comment to cancel a sentence.

Go to file path:/etc/apache2/ find httpd.conf files, can be edited with tools such as VI, the following is a simple way to edit.

Right-to-open and other then select a text Editing tool in the recommendation, which is opened using the sublime. See:

Then search "PHP", "#LoadModule php5_module libexec/apache2/" before the # Save, then restart Apache, and then enter the address:/HTTP Localhost/test.php becomes the following interface:

Indicates that PHP was enabled successfully.

But you will find that adding files in document often requires authorization, and we can create a sites directory for ourselves as the root directory for personal sites, share and test files.

3. Setting up personal Sites

First, in the ~ your username/directory to create a directory sites, inside a new test file a.html, inside write: ABCDEFG

Then, under ~/etc/apache2/users/, create a new user name. conf file, or copy a guest.conf and rename it, and write the following in it:

<directory "/users/your username/sites/" >    Options Indexes multiviews    allowoverride all    Order Allow,deny Allow from    all</directory>
After the terminal input: sudo chmod 755/etc/apache2/users/the file name you just built. conf authorization

Finally you enter in the browser: http://localhost/~ Your user name/a.html will display the following interface:

Description success, if your LAN IP is, you want to share files to LAN friends, you can directly drag files into the Sites directory, friends by visiting your user name you can see the resources.

Click on the other side to download.

4. Install MySQL

The method of installing MySQL is super simple, it is not explained in detail, only provides two download connection.

Http:// are many versions, select the appropriate download for yourself.

Remember to install the mysqlstartupitem.pkg in the software so you don't have to start it manually every time. The figure is as follows:

So the whole environment is well-equipped.

Mac OSX 10.9.4 Mavericks enable system Apache, PHP services

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: 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.