在Mac 系統上使用MAMP搭建PHP開發環境

1.下載MAMP套件php

下載地址爲https://www.mamp.info/en/html

2.安裝此.dmg文件apache

3.配置apache虛擬主機瀏覽器

(1)在/Applications/MAMP/conf/apache中找到httpd.conf文件ide

在此文件中找到測試

# Virtual hostsspa

Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.confcode

去除前面的#htm

(2)在/Applications/MAMP/conf/apache/extra中找到httpd-vhosts.conf文件,配置虛擬主機以下代碼:blog

<VirtualHost *:80> ServerAdmin localhost DocumentRoot "/Applications/MAMP/htdocs/" ServerName localhost ErrorLog "logs/localhost-error_log" CustomLog "logs/localhost-access_log" common DirectoryIndex index.html index.htm index.php <Directory /> Options FollowSymLinks #不容許別人修改咱們的頁面 AllowOverride None #設置訪問權限 order deny,allow Allow from all </Directory>
</VirtualHost>

(3)配置/etc/hosts文件以下:

127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost 127.0.0.1 www.test.com 127.0.0.1       local.erp.com

4.測試:

在瀏覽器中輸入localhost:8888/index.php

相關文章
相關標籤/搜索