Mac OS X中使用XAMPP

2017-03-25  本文已影响961人  Show_Perry

XAMPP(Apache+MySQL+PHP+PERL)是一个功能强大的建站集成软件包。支持Windows、Linux、Solaris、Mac OS X 等多种操作系统下安装使用,支持多语言。对于刚接触PHP后台开发的同学来说,省了很多事情,可以快速建立自己的服务器。

下载地址

XAMPP选择OS X系统最好下载最新的版本。

配置虚拟主机

<Directory />
    AllowOverride none
    Require all denied
</Directory>

改为:

<Directory />
    AllowOverride none
#    Require all denied
     Require all granted
</Directory>

保存并退出。

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host.example.com"
#    ServerName dummy-host.example.com
#    ServerAlias www.dummy-host.example.com
#    ErrorLog "logs/dummy-host.example.com-error_log"
#    CustomLog "logs/dummy-host.example.com-access_log" common
#</VirtualHost>

#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host2.example.com
#    DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host2.example.com"
#    ServerName dummy-host2.example.com
#    ErrorLog "logs/dummy-host2.example.com-error_log"
#    CustomLog "logs/dummy-host2.example.com-access_log" common
#</VirtualHost>


<VirtualHost *:80>
# This is not needed but seriously recommended
    ServerAdmin admin@XXX.com
# Path to your folder
    DocumentRoot "/Users/aimoke/Documents/MyPHPWorkspace/dev"
# This line is your host name (example.dev if you prefere)
    ServerName local.design.com
# You can add another server name using ServerAlias
    ServerAlias zhuo.dev
# For the error file, exactly like you did
    ErrorLog "/private/var/log/apache2/sites-error_log"
    CustomLog "/private/var/log/apache2/sites-access_log" common
# A little bonus that remove the server signature from http requests
    ServerSignature Off
# Here are options neeeded to authorizations and I added some classical options
 <Directory "/Users/aimoke/Documents/MyPHPWorkspace/dev">
    Options -Indexes +FollowSymLinks +MultiViews
    AllowOverride all
    Require all granted
 </Directory>
</VirtualHost>

保存并退出,并重启Apache。这里的ServerAdminDocumentRoot,ServerName可以根据自己的实际情况进行修改。但是ServerName要和下一步骤hosts中对应起来。

其实XAMPP的配置和Mac OS X中配置Apache基本一样。但是需要注意的是不要和系统自带的Apache同时开启。

上一篇 下一篇

猜你喜欢

热点阅读