Configure PHP and the virtual machine (macapache) for Apache that comes with Mac. Configure PHP and virtual machines for Apache that comes with Mac. macapache Operating system: osx10.11.21. start apache to open the terminal (terminal) and enter the command: sudoapachectl-kstart; configure PHP and virtual machines for Apache that comes with Mac in the browser, macapache
Operating system: OS x 10.11.2
1. start apache
Open the terminal and enter the command sudo apachectl-k start;
Enter http: // localhost in the address bar of the browser. if the following information is displayed, apache is started normally.
Apache commands: start: sudo apachectl start stop: sudo apachectl stop restart: sudo apachectl restart View version: sudo apachectl-v
2. add the PHP module
Enter the command sudo vi/etc/apache2/httpd. conf in the terminal to open httpd. conf.
Remove the comment '#' in front of the PHP module, restart apache, and add php successfully.
3. configure the 'myusers' virtual machine
1. enter the command mkdir/Users/your user name/Sites on the terminal and add this folder as the physical storage location of the 'myusers' virtual machine.
2. open httpd. config and remove"# Include/private/etc/apache2/extra/httpd-vhosts.conf "in front '#'.
3. select DocumentRoot "/Library/WebServer/Documents" ... And copy the content to the bottom of it. modify the yellow area to "/Users/your username/Sites", save and exit.
Enter the command in the terminal: sudo vi/etc/apache2/extra/httpd-vhosts.conf to open the httpd-vhosts.conf.
Comment out two default virtual machines, and add '#' before each line '#'
Next, add the following code, save and exit, and restart apache.
# 'Localhost' virtual machine
DocumentRoot "/Library/WebServer/Documents" ServerName localhost ErrorLog "/private/var/log/apache2/localhost-error_log" CustomLog "/private/var/log/apache2/localhost-access_log" common
# 'Myusers' virtual machine
DocumentRoot "/Users/your username/Sites" ServerName mysites ErrorLog "/private/var/log/apache2/mysites-error_log" CustomLog "/private/var/log/apache2/mysites-access_log" common
Run the following command on the terminal: sudo vi/etc/hosts, add "127.0.0.1 mysites", save and exit
Enter the command in the terminal: sudo vi/Users/your username/Sites/info. php, and add" ", Save and exit
Enter http: // mysites/info. php in the browser
This is the end. thank you for reading!
Written in 2016.1.12
Reference: http://www.cnblogs.com/snandy/archive/2012/11/13/2765381.html
Guest operating system: OS x 10.11.2 1. start apache to open the terminal (terminal), enter the command: sudo apachectl-k start; in the browser...