MAC system comes with Apache and PHP, as long as you turn it on and use it
1. Modifying the Apache configuration file
sudo vim/etc/apache2/httpd.conf.
Uncomment the next two lines
LoadModule rewrite_Module Libexec/apache2/mod_rewrite.so
LoadModule Php5_module libexec/apache2/libphp5.so
Comment out 221 lines of #Require all denied
212 #ServerName www.example.com:80
213
214 #
215 # Deny access to the entirety of your server ' s filesystem. You must
216 # explicitly permit access to Web content directories in other
217 # blocks below.
218 #
219
allowoverride None
221 # Require All denied
222
Also uncomment 499 lines to make Apache's vhost settings effective
497
498 # Virtual Hosts
499 include/private/etc/apache2/extra/httpd-vhosts.conf
500
501 # Local access to the Apache HTTP Server Manual
502 #Include/private/etc/apache2/extra/httpd-manual.conf
2. Vim/etc/apache2/extra/httpd-vhosts.conf
Add the following (Sheng is my username, xxx is the virtual domain name you added)
DocumentRoot "/users/sheng/site/ xxx"
ServerName xxx. com
XXX ">
Options FollowSymLinks
AllowOverride All
Require all granted
3. Modify the host settings for this computer
Vim/etc/hosts
Add a row
127.0.0.1 xxx.com
4. Open the terminal command line
sudo apachectl start.
5. put a index.php file in /users/sheng/site/xxx
You can write to the following content. (MAC OSX 10.10 php version above 5.4, rest assured with a short label)
echo "Hello php";
?>
Open your browser
Type
XXX.com
and try Out!
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The above describes the Mac OSX 1010 enabled by the Apache and PHP, including aspects of the content, I hope the PHP tutorial interested in a friend to help.