Enable your own Apache and PHP under MAC OSX 10.10

Source: Internet
Author: User

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 # <Directory> blocks below.
218 #
219 <directory/>
allowoverride None
221 # Require All denied
222 </Directory>


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)

<virtualhost *:80>
DocumentRoot "/users/sheng/site/xxx"
ServerName xxx. com
<directory "/users/sheng/site/xxx" >
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

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, do not know why the short label is not available by default)

<?php

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.

Enable your own Apache and PHP under MAC OSX 10.10

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.