配置 Apache 和 PHP
打开 Apache 安装目录下的 conf 子目录中的 httpd.conf 文件。
1. 找到:
DocumentRoot “xxxxxxx”
改成你本机的网站内容的目录。例如我的:
DocumentRoot “E:/web”
改完之后往下稍微拉动一下,找到“# This should be changed to whatever you set DocumentRoot to.”,然后把下面这个地方也改过来
<Directory “E:/web”>
2. 找到 LoadModule,根据你的 php 安装目录,在下面空白处加上这两行:
LoadModule php5_module “D:/PHP/php5apache2_2.dll”
PHPIniDir
“D:/PHP”
3. 找到:
DirectoryIndex index.html
修改为:
DirectoryIndex index.php index.html
4. 找到:
AddType application/x-gzip .gz .tgz
添加这几行:
AddType application/x-httpd-php .php .inc
AddType application/x-httpd-php .html
AddType application/x-httpd-php-source .phps
5. 保存 httpd.conf