Mac Configuring PHP Development Environment

As we all know, Mac developers are very friendly, built a lot of language development environments such as Ruby, Python, PHP, this paper for everyone to talk about the configuration Xiao Ming PHP environment.

Apache open service

We need to write good PHP file running under Apache, but Apache service in Mac seed is off by default, so we need to look to modify the configuration file:

  1. Apache service is installed by default in the path / Private / etc / apache2 , belonging to the private system directory. Locate and open the directory httpd.conf file

    vim http.conf
  2. Search #LoadModule php7_module libexec / apache2 / libphp7.so , ahead of the # to delete

  3. You can start the Apache service

    sudo apachectl start
  4. When you first start, we can enter in the browser http: // localhost or http://127.0.0.1 website to check whether the Apache service started successfully. If the Apache service starts successfully, the page will display It works!

Apache command on services

  1. Start Apache Service
sudo apachectl start
  1. View Apache service version
sudo apachectl -v
  1. Close Apache Service
sudo apachectl stop
  1. Restart Apache Service
sudo apachectl restart

Apache project deployment directory

Apache service default deployment path in the / Library / WebServer / Documents / So we need to place items in the path.

  1. We can also in / Library / WebServer / Documents / create a new one under info.php test program.

    <?php phpinfo(); ?>
  2. Enter the following URL in your browser to view the PHP information
    http: //localhost/info.php

Of course, we can also modify the deployment path, you can in / private / etc / apache2 locate and open the directory httpd.conf file, search Documentroot and modify the deployment path, restart apache to take effect.

Port number of the

Apache service default port number is 80, if you want to modify the port number, you can / private / etc / apache2 directory to find and open the httpd.conf file, search Listen 80 and change the port number.

Welcome attention to micro-channel public number "programmer Xiao Ming", for more resources.
Programmer Xiao Ming

Guess you like

Origin www.cnblogs.com/coderxx/p/12151535.html