Apache配置过程以2.2为例。 1、2.4中配置可能会出现拒绝访问的情况,You don’t have permission to access / on this server,原因是httpd.conf在2.4里是: AllowOverride none Require all denied 改为 AllowOverride none Require all granted Virtual hosts #Include conf/extra/httpd-vhosts.conf 为 Virtual hosts Include conf/extra/httpd-vhosts.conf 同时在httpd-vhost.conf中做以下配置: <VirtualHost *:80> ServerName cwj.sl DocumentRoot "D:/web/cwj" <Directory "D:/web/cwj"> DirectoryIndex index.php Allow from all # DirectoryIndex index.php index.html Options +Indexes +FollowSymLinks +ExecCGI Order allow,deny Satisfy all AllowOverride all </Directory> </VirtualHost> 4、让Apache解析php 用文本编辑器打开 E:\Apache24\conf\httpd.conf 文件,找到 #LoadModule vhost_alias_module modules/mod_vhost_alias.so 并在其下一行添加如下配置: 以 module 方式加载 php LoadModule php5_module “E:/php-5.5.34/php5apache2_4.dll” 指明 php 配置文件 php.ini 的位置 PHPIniDir “E:/php-5.5.34” 2. 找到 AddType application/x-gzip .gz .tgz 并在其下一行添加如下配置: 定义能够执行 php 的文件类型,即.php和.html的文件能执行PHP程序 AddType Application/x-httpd-php .php .html 3. 将 E:\php-5.5.34\php.ini-development 改名为 E:\php-5.5.34\php.ini ,并用文本编辑器打开 php.ini 文件,到 extension_dir = “./” 一行,去掉注释并将其替换为 extension_dir = “E:/php-5.5.34/ext” ; extension_dir = “E:/php-5.5.34/ext” 4. 重启 Apache 服务器;