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:
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
Search #LoadModule php7_module libexec / apache2 / libphp7.so , ahead of the # to delete
You can start the Apache service
sudo apachectl start
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
- Start Apache Service
sudo apachectl start
- View Apache service version
sudo apachectl -v
- Close Apache Service
sudo apachectl stop
- 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.
We can also in / Library / WebServer / Documents / create a new one under info.php test program.
<?php phpinfo(); ?>
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.