
2.然后对http.conf(D:phpEnvApache24confhttp.conf)配置文件进行修改-使用记事本打开就行
(1)修改ServerRoot Apache的根路径:
(37行)ServerRoot"c:/Apache24"改成=>ServerRoot "D:/phpEnv/Apache24"
(2)修改ServerName你的主机名称:
如果此行不修改则启动apache 提示Starting httpd: AH00558
(217行)ServerName www.example.com:80将前面的#去掉,该属性在从命令行启动Apache时需要用到。
(3)修改DocumentRoot Apache访问的主文件夹目录,就是php、html代码文件的位置。Apache默认的路径是在htdocs(D:phpEnvApache24htdocs)下面,里面会有个简单的入口文件index.html。这个路径可以自己进行修改,我这里将其配置在我自己新建的文件夹www(D:phpEnvwww)下。
(247行) DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
改为=>
DocumentRoot "D:phpEnvwww"
<Directory "D:phpEnvwww">
(4)修改入口文件配置:DirectoryIndex一般情况下我们都是以index.php、index.html、index.htm作为web项目的入口。Apache默认的入口只有index.html需要添加其他两个的支持,当然这个入口文件的设置可以根据自己的需要增减,如果要求比较严格的话可以只写一个index.php,这样在项目里面的入口就只能是index.php
(274行)<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
改为=>
<IfModuledir_module>
DirectoryIndex index.php index.htm index.html
</IfModule>
(5)设定serverscript的目录:
(358行)ScriptAlias/cgi-bin/ "c:/Apache24/cgi-bin/"改为=> ScriptAlias/cgi-bin/ "D:/phpEnv/Apache24/cgi-bin"
(6)(380行)
<Directory "c:/Apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
改为=>
<Directory "D:/phpEnv/Apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
3、接下来就可以启动Apache了
开始---运行,输入cmd,打开命令提示符。接着进入D:phpEnvApache24in目录下回车httpd回车,如图所示.
没有报错的话就可以测试了(保持该命令窗口为打开的状态)。
把Apache24htdocs目录下的index.html放到D:phpEnvwww目录下,用浏览器访问会出现“It works”那么就说明apache已经正确安装并启动了。也可以自己写一个简单的index.html文件也可以打开。

4、将Apache加入到window服务启动项里面并设置成开机启动
先关闭httpd的服务(将命令窗口关闭即可)
重新打开一个新的命令窗口进入到D:phpEnvApache24in目录下:
添加HTTP服务的命令是:httpd.exe -kinstall -n "servicename" servicename是服务的名称,我添加的是:httpd.exe -k install -n "Apache24"命令成功后会有成功的提示,此时你可以在window服务启动项中看到Apache24这个服务
然后点击启动就可以了,如果不想设置成开机启动的话也可以将启动类型修改为手动。
如果要卸载这个服务的话,先要停止这个服务,然后输入httpd.exe -k uninstall -n "Apache24"卸载这个服务。
当然也可以通过D:phpEnvApache24in下面的ApacheMonitor.exe来启动Apache这里就不多说了
如此Apache的配置就基本完成了。

二、安装配置php5.5.10(php-5.5.10-Win32-VC11-x64.zip)
1、将下载的php-5.5.10-Win32-VC11-x64.zip 解压到安装目录下我的是(D:phpEnvphp)
2、将目录下的php.ini-development文件复制一份并改名为php.ini他是php的配置文件
3、为Apache服务添加php支持
打开Apache的配置文件http.conf在最后加上
# php5 supportLoadModule php5_module “D:/phpEnv/php/php5apache2_4.dll”AddHandler application/x-httpd-php .phpAddType application/x-httpd-php .html .htm# configure thepath to php.iniPHPIniDir "D:/phpEnv/php"这里我添加在LoadModule下面

4.重启Apache服务器。
5.测试。
删除www中其他文件,新建一个index.php,内容为<?php phpinfo(); ?>保存,访问出现php的信息就说明php已经成功安装。
备注:
Php的一些常用配置修改:(D:phpEnvphpphp.ini)
时区的设置:date.timezone = Asia/Shanghai
错误报告等级:error_reporting = E_ALL这个在开发模式下可以全部打开。
三、安装配置mysql5.6.16(mysql-5.6.16-winx64.zip)
1、安装mysql
64位的mysql暂时没找到msi的安装包,因此直接解压到安装目录下,然后配置相关的环境变量,修改配置文件,添加window服务就行,这里就不详细写了。这里把我的配置文件贴出来给大家参考下:
[mysqld]loose-default-character-set = utf8 basedir = D:/program/mysql-5.6datadir = D:/program/mysql-5.6/dataport = 3306sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES character_set_server = utf8[client]loose-default-character-set = utf8注:basedir是mysql的根目录,datadir是mysql的数据存储目录。其他的我就不做解释了
extension=php_mysql.dllextension=php_mysqli.dll当然也可以打开881行的php_pdo_mysql.dll启用php的pdo支持我一般都用这个。
mysql -uroot -pEnter password:Welcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is 1Server version: 5.1.32-community MySQL Community Edition (GPL)Type "help;" or "h" for help. Type "c" to clear the buffer.mysql>注意:MySQL的管理员用户名为root,密码默认为空。
mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || test |+--------------------+3 rows in set (0.02 sec)可以看到MySQL服务器中有三个数据库。
mysql> use testDatabase changed7)、查看数据库中的表
mysql> show tables;Empty set (0.00 sec)8)、创建表ttt
mysql> create table ttt(a int,b varchar(20)); Query OK, 0 rows affected (0.00 sec)9)、插入三条数据
mysql> insert into ttt values(1,"aaa"); Query OK, 1 row affected (0.02 sec)mysql> insert into ttt values(2,"bbb"); Query OK, 1 row affected (0.00 sec)mysql> insert into ttt values(3,"ccc"); Query OK, 1 row affected (0.00 sec)10)、查询数据
mysql> select * from ttt;+------+------+| a | b |+------+------+| 1 | aaa || 2 | bbb || 3 | ccc |+------+------+3 rows in set (0.00 sec)11)、删除数据
mysql> delete from ttt where a=3;Query OK, 1 row affected (0.01 sec)删除后查询操作结果:
mysql> select * from ttt; +------+------+| a | b |+------+------+| 1 | aaa || 2 | bbb |+------+------+2 rows in set (0.00 sec)12)、更新数据
mysql> update ttt set b = "xxx" where a =2;Query OK, 1 row affected (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 0查看更新结果:
mysql> select * from ttt; +------+------+| a | b |+------+------+| 1 | aaa || 2 | xxx |+------+------+2 rows in set (0.00 sec)13)、删除表
mysql> drop table ttt; Query OK, 0 rows affected (0.00 sec)查看数据库中剩余的表:
mysql> show tables;Empty set (0.00 sec)三、更改MySQL数据库root用户的密码
mysql> use mysqlDatabase changed2、查看mysql数据库中所有的表
mysql>show tables; +---------------------------+| Tables_in_mysql |+---------------------------+| columns_priv || db || func || help_category || help_keyword || help_relation || help_topic || host || proc || procs_priv || tables_priv || time_zone || time_zone_leap_second || time_zone_name || time_zone_transition || time_zone_transition_type || user |+---------------------------+17 rows in set (0.00 sec)3、删除mysql数据库中用户表的所有数据
mysql> delete from user; Query OK, 3 rows affected (0.00 sec)4、创建一个root用户,密码为"xiaohui"。
mysql>grant all on *.* to root@"%" identified by "xiaohui" with grant option; Query OK, 0 rows affected (0.02 sec)5、查看user表中的用户
mysql> select User from user; +------+| User |+------+| root |+------+1 row in set (0.00 sec)6、重启MySQL:更改了MySQL用户后,需要重启MySQL服务器才可以生效。
mysql -uroot -pxiaohui Welcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is 1Server version: 5.1.32-community MySQL Community Edition (GPL)Type "help;" or "h" for help. Type "c" to clear the buffer.mysql>
mysql> create database testdb;Query OK, 1 row affected (0.02 sec)2、使用数据库testdb
mysql> use testdb;Database changed3、删除数据库testdb
mysql> drop database testdb; Query OK, 0 rows affected (0.00 sec)4、退出登陆
mysql>exit ByeC:Documents and SettingsAdministrator>五、操作数据库数据的一般步骤