PHP Mac System Environment configuration

Source: Internet
Author: User
Tags php and mysql

Mac system is very friendly to PHP, we only need to make simple configuration can start to use, this article will step by step to explain the installation and configuration of Apache, PHP and MySQL, pave the way for the start of development

Apache launches Apache Service

The Apache service is already installed on the MAC system and we just need to launch it directly using the following method

Enter the following command in the terminal to launch the Apache service
sudo apachectl start
Enter the following command in the terminal to view the Apache service version
sudo apachectl-v

In this machine, the version information is as follows

Server version:apache/2.4.18 (Unix) server built:   FEB 20 2016 20:03:19
In the browser, enter the following URL to check whether the Apache service started successfully
http://localhosthttp://127.0.0.1

If the Apache service starts successfully, the page will show it works!

Apache other configuration off Apache service

Close the Apache service by entering the following command in the terminal

sudo apachectl stop
Restart Apache Service

Restart the Apache service by entering the following command in the terminal

sudo apachectl restart
Apache Service installation Path

Apache Service default installation path in/private/etc/apache2, belongs to the system Private directory, we do not find the path directly in the Finder

We can enter the path in two ways

1. Enter the OPEN/ETC command into the ETC folder in the terminal

2. Enter/etc in the go to folder in the Finder, go to the ETC folder

Apache Service Deployment Path

Apache Service deployment path in/resource pool/webserver/documents/, our project needs to be placed under this path, if you want to modify the deployment path, you can find and open the httpd.conf file in the/private/etc/apache2 directory, Search for DocumentRoot and modify the deployment path

Tip:mac after modifying the immature path, the deployment file requires the chmod 777 command to grant access

Apache Service port number

The Apache service port number defaults to 80, if you want to modify the port number, you can find and open the httpd.conf file in the/private/etc/apache2 directory, search for listen 80 and modify the port number

Php

PHP boot only needs to be configured in Apache service for direct use

First, locate and open the httpd.conf file in the/private/etc/apache2 directory

Second, search #loadmodule php5_module libexec/apache2/libphp5.so, will be in front of the # Delete

Again, restart the Apache service to

Finally, let's create a new info.php test program under the path and try the results.

<?php phpinfo ();?>

Enter the following URL in the browser to view PHP information

http://localhost/info.php

PHP Mac System Environment configuration

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.