| 好久没搭环境了,这次还算顺利。 先来回顾一下网站运行的原理。 OK,进入正题,本次搭建环境wamp版本如下: Apache24: httpd-2.4.26-x64-vc11php:php-5.6.30-Win32-VC11-x64
 mysql:mysql-installer-community-5.5.56
 1.文件夹路径如下: (因配置文件 httpd.conf中多处默认路径为Apache24,方便起见文件夹名不做改动) 2.Apache安装   保持cmd光标闪动状态,即正在运行。测试地址栏 http://localhost,显示默认主页即表示可运行。大部分情况,我们要把Apache当作Windows服务器,故需要安装Apache在cmd中,上述路径下,httpd -k install       httpd -k start此时在计算机服务中已加入该服务。为了使得在任何地方都可通过 httpd.exe运行该服务,需要添加环境变量。系统---高级系统设置---环境变量。
  3.PHP安装 下载并解压至php文件夹,nts版本不含 php5apache2_4.dll文件,无法被Apache加载,此处选择ts版本。为了能在cmd根目录下运行 php.exe,首先设置环境变量。设置环境变量之后,可在cmd根目录下运行命令 php.exe -f  php文件路径,来运行PHP文件,如 <?php 
for($i=1;$i<=10;$i++){
    echo "$i";        
}?> 则在cmd模式下会显示 12345678910 *php可独立运行。
 4.配置httpd.conf,使Apache可处理php  5.配置php.ini,使其可加载其他模块   6.配置虚拟主机  修改 httpd.conf,将#去掉,就可以启用设置 #Virtual hosts
 Include conf/extra/httpd-vhosts.conf 修改 httpd-vhost.conf 添加:
<VirtualHost *:80>
    DocumentRoot "G:/color"
    ServerName color.com
    ErrorLog "logs/color.log"
    CustomLog "logs/color.log" common
</VirtualHost>  将 httpd.conf 的Require all denied注释,即 <Directory />
    AllowOverride none
  # Require all denied
</Directory>
缺少这一步,会显示 403 Forbidden  
  7.安装mysql 下载 (选择MSI Installer)安装略。测试是否可正常运行 C:>net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。
C:>net start mysql
MySQL 服务正在启动.
MySQL 服务已经成功启动。 登录到mysql服务器 C:>mysql.exe -hlocalhost -uroot -proot
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.5.56 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> 即表示登陆mysql成功。
 至此,环境已经基本搭建完成。重启apache命令:httpd -k restart |