Heim  >  Artikel  >  php教程  >  php环境配置 php5 mysql5 apache2 phpmyadmin安装与配置

php环境配置 php5 mysql5 apache2 phpmyadmin安装与配置

WBOY
WBOYOriginal
2016-06-13 12:37:071221Durchsuche

php环境的配置,对于新手来说,绝对是一件烦事。总会遇到这样那样的问题,走很多弯路。
所以今天特意写了这个配置文档,相信按照以下步骤你一定会成功的。错误的地方也希望各
位指正。
更多文章 php爱好者站 http://www.phpfans.net

本例是在wiondws下 apache2.0.55  php5.1.1(zip)  mysql5.0.19  phpmyadmin2.7.0安装与配置
以上资源可以在本站下载站http://www.phpfans.net/download.php/下载

/*
作者:我不是鱼
网址:http://www.phpfans.net
博客:http://www.phpfans.net/space/index.php/2
email:deng5765@163.com
*/

Apache 的安装
1 点击apahce安装包
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134330520.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213021P-0.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

2 下面3项随便填
    apache 监听80 端口。如果iis用了80端口,修改iis端口或者apache端口,以免冲突
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134333421.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/042130O54-1.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

3 这里默认的是 typical。如果想修改安装路径的话也可以选择custom,注意安装路径不能含中文
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134333562.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421303335-2.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

4 开始安装
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134333178.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213025R-3.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

5 安装完成后在浏览器里打入  http://localhost
如果可以看到这个页面,证明apache安装成功,已经可以解释静态页面了
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134333802.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421302Z8-4.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

MySQL 的安装

1 点击mysql安装包
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134334711.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213011O-5.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

2 默认是Typical,如果想修改安装路径的话也可以选择custom.
注意:安装mysql的路径中,不能含有中文!
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134334786.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421303145-6.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

3 安装开始
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134334901.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/042130A12-7.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

4 跳过注册
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134334493.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421305O3-8.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

5 是否现在就配置 mysql。也可以之后在开始菜单的configuration wizard 进行配置
  这里是现在进行配置
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134335500.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421303929-9.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

6 选择Detailed Configuration,点Next继续
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134335170.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/042130KQ-10.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

7 下面这个选项是选择mysql应用于何种类型,第一种是开发服务器,
将只用尽量少的内存,第二种是普通WEB服务器,将使用中等数量内存,
最后一种是这台服务器上面只跑mysql数据库,将占用全部的内存。
用户可根据自己的需求,选择选项。这里只选择开发服务器,点Next继续
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134335825.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/042130B96-11.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

8 下面是选择数据库用途,第一种是多功能用途,
将把数据库优化成很好的innodb(事务)存储类型和高效率的myisam(非事务)存储类型,
第二种是只用于事务处理类型,最好的优化innodb,但同时也支持myisam,只有myisam才支持全文索引
最后一种是非事务处理类型,适合于简单的应用,只有不支持事务的myisam类型是被支持的。
一般选择第一种多功能的。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134335511.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421305954-12.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

9 下面是选择InnodDB的数据存放位置,一般默认好了,不需要改动
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134336911.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/042130KB-13.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

10 下面是选择mysql允许的最大连接数,第一种是最大20个连接并发数,
第二种是最大500个并发连接数,最后 一种是自定义,你可以根据自己的需要选择。
这里选择第一个
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134336287.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421304423-14.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

11下面是选择数据库监听的端口,一般默认是3306,如果改成其他端口,
以后连接数据库的时候都要记住修改的端口,否则不能连接mysql数据库,
比较麻烦,这里不做修改,用mysq的默认端口:3306
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134336807.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213045Z-15.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

12 这一步设置mysql的默认编码,默认是latin1,也是标准的编码
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134336376.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213050B-16.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

13 当然我们可以根据需要,把它改成gb2312或gbk。编码是版本4.1以上引入的。
如果要用原来数据库的数据,最好能确定原来数据库用的是什么编码,如果这里设置的编码
和原来数据库数据的编码不一致,在使用的时候可能会出现乱码.建议使用latin1标准编码
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134337691.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421304H3-17.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

14 这一步是是否要把mysql设置成windows的服务,一般选择设成服务,
这样以后就可以通过服务中启动和关闭mysql数据库了。推荐:下面的复选框也勾选上,
这样,在cmd模式下,不必非到mysql的bin目录下执行命令。在命令行下咨询可以执行文件
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134337450.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421305927-18.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

15 这一步是设置mysql的超级用户密码,这个超级用户非常重要,
对mysql拥有全部的权限,请设置好并牢记超级用户的密码,
下面有个复选框是选择是否允许远程机器用root用户连接到你的mysql服务器上面,
如果有这个需求,也请勾选。
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134337855.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421304110-19.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

16 点击 Execute
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134338697.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421304402-20.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

17 到这一步
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134338325.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421303019-21.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

18 我们可以开始使用mysql了,打开开始菜单的 mysql Command line Client,输入密码
出现这个界面说明mysql已经安装好了
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134338105.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421304c8-22.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

可能出现的问题:
如果在第15步,你出现的界面是像下面这样
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134338728.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421302424-23.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
有三个输入密码的地方,则有可能您是在原来基础上安装的。
你在第一个文本框输入原来root的密码,后面两个文本框输入root的新密码,
点击Next基础,出现下图
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134339444.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421305351-24.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>
给您推荐几种解决办法:
1、        点Retry,重试;
2、         再运行一次设置,看到有关“移除原设置”的选项,选择移除,然后在重新设置。
3、        重装。
重装注意事项:最好删除原来的所有文件,必要的话,可以清一下注册表,
如果你机器上没有其它mysql相关的程序。而且一定记得不要保留原有的my.ini文件。
还有就是删除原来安装路径下的文件,并删除数据目录下面的ibdata1文件.
更多文章 php爱好者站 http://www.phpfans.net

PHP 的安装

由于php是一个zip文件(非install版),安装较为简单
解压就行。把解压的 php5.1.1-Win32重命名为 php5。并复制到C盘目录下。即安装路径为 c:\php5

1  找到php目录下的 php.ini-dist或 php.ini.recommended文件,重命名为 php.ini
并复制到系统盘的windows目录下(以c:\windows为例).

2  再把php目录下的php5ts.dll,libmysql.dll复制到目录 c:\windows\system32下。
如果没把libmysql.dll复制到system32下,在重启apache时可能会出现如下警告
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134339956.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421304G0-25.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

3  把php5\ext目录下的php_gd2.dll,php_mysql.dll,php_mbstring.dll文件复制到c:\windows\system32下
如果没有加载 php_gd2.dll  php将不能处理图像。没有加载php_mysql.dll php将不支持mysql函数库
php_mbstring.dll在后面使用phpmyadmin时支持宽字符

所有东西安装完成后我们再进行配置

配置php并关联MySQL
以下内容跟帖回复才能看到
==============================

打开c:\windows\php.ini文件

1 设置扩展路径
查找 extension_dir 有这么一行
extension_dir = "./"
将此行改成
extension_dir = "C:\php5\ext"
其中C:\php5是你安装php的路径。路径不正确将无法加载dll
(注意:有些php版本是 ;extension_dir = "./" 要把前面的分号去掉)

2 查找 extension
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_mysql.dl
把上面3项前面的分号去掉,这样apache启动时就可以加载这些dll了
当然前面我们也把这些dll复制到system32下了l

3 设置会话保存路径
查找session.save_path 有这么一行
;     session.save_path = "N;/path"
在此行后加入一行(注意是加入一行,不是加到后面)
session.save_path = "C:\WINDOWS\Temp"
保存到你的临时目录下,这里完全可以保存到windows临时目录Temp下

4 还有比较值得注意的是 short_open_tag 默认是Off的
也就是说 php不能使用短标记如 ?> 必须使用
由于短标记使用方便,并且很多程序也是用短短标记来写,如discuz等
如果不把 short_open_tag 改成On将出现的症状将很难判断是上面原因,这里建议修改
查找
short_open_tag = Off
改为
short_open_tag = On

5 是否显示错误 display_errors
出于安全性考虑,display_errors 也默认为 Off
就是说在调试时,如果php代码有误,就只出现一个空白页。而不会显示出错原因和出错行数。
这样调试起来将非常不便,建议根据自己需要修改
查找
display_errors = Off           (注意不是 ; - display_errors = Off           [Security])
改成
display_errors = On

6 register_globals
出于安全性考虑它默认也是Off
当register_globals=Off的时候,下一个程序接收的时候应该用$_POST['user_name']和$_POST['user_pass'])
当register_globals=On的时候,下一个程序可以直接使用$user_name和$user_pass来接受值。
更详细的说明请参考
http://www.phpfans.net/bbs/archiver/?tid-234.htm
建议根据自己需要修改

7 php5时差问题
时间相差八小时
为什么呢?PHP5系列版本新增了时区设置,默认为格林威治时间,与中国所在的东8区正好相差8个小时
查找date.timezone有这么一行
;date.timezone =
将;去掉,改成
date.timezone = PRC
其中PRC:People's Republic of China 中华人民共和国,
更详细解决方法请参考本论坛的
http://www.phpfans.net/bbs/archiver/?tid-60.html
更多文章 php爱好者站 http://www.phpfans.net

Apache整合PHP

1 从开始菜单打开apache配置文档,如图
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134339950.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213041O-26.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

2 修改网站根目录
查找 DocumentRoot有这么一行
DocumentRoot"C:/Program Files/Apache Group/Apache2/htdos"
这就是你网站的根目录,你可以修改,也可以用默认的.如果改,还要修改下面这项,否则可能会出现 403 错误
查找  This should be changed to whatever you set DocumentRoot to
在它下面两行有

把上面两项的 C:/Program Files/Apache Group/Apache2/htdos 改成你想要的目录

3 查找  DirectoryIndex index.html index.html.var
修改成
DirectoryIndex index.html index.html.var  index.php
这样index.php 可以充当默认页面了

4 Apache中模块化安装php
查找 # LoadModule foo_module modules/mod_foo.so
在此行后加入一行
LoadModule php5_module C:/php5/php5apache2.dll

其中C:/php5/php5apache2.dll是你安装php的相应路径.
注意不要把php5apache2.dll和php5apache.dll混淆.php5apache.dll只适用于apache 版本1的.
注意: PHP5压缩包里的php5apache2.dll只适用于apache2.0.*版本,如果是2.2.*以上版本,就可能会出现
"Cannot load C:/php/php5apache2.dll into server: The specified module could not be found."
或者:
"The requested operation has failed"
的情况.关于这个问题的解决方法可以参考本论坛的
http://www.phpfans.net/bbs/viewt ... &extra=page%3D1

5 查找 AddType application/x-gzip .gz .tgz
在此行后加入一行
AddType application/x-httpd-php .php
这样apache就可以解释php文件了
到这里配置基本完成了

########重启apache#########

在网站根目录下创建一个 phpinfo.php 文件

phpinfo();
?>

在浏览器打开
http://localhost/phpinfo.php
如果出现如下信息,则说明php已经配置好了
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134339543.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213053Y-27.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

下面再测试php和mysql数据库的关联
在网站根目录下创建一个test.php 文件

CODE:
[Copy to clipboard]
<font color="#000000"><font color="#0000bb"></font><font color="#007700"></font><font color="#0000bb">php <br>$link</font><font color="#007700">=</font><font color="#0000bb">mysql_connect</font><font color="#007700">(</font><font color="#dd0000">"localhost"</font><font color="#007700">,</font><font color="#dd0000">"root"</font><font color="#007700">,</font><font color="#dd0000">"12345"</font><font color="#007700">);  </font><font color="#ff8000">//12345改成你的mysql密码 <br></font><font color="#007700">if(!</font><font color="#0000bb">$link</font><font color="#007700">) echo </font><font color="#dd0000">"失败!"</font><font color="#007700">; <br>else echo </font><font color="#dd0000">"成功!"</font><font color="#007700">; <br></font><font color="#0000bb">mysql_close</font><font color="#007700">(); <br>?> </font><br></font>
在浏览器打开 http://localhost/test.php
如果输出成功,则说明大功告成了.

安装 phpMyAdmin

下载得到 phpMyAdmin-2.7.0.zip,将其解压到 你网站根目录下并重命名为phpMyAdmin,
找到并打开 config.defaut.php (有些版本是config.inc.php或者 libraries/config.default.php)
做以下修改:

1 查找 password 有如下两行
$cfg['Servers'][$i]['user']          = 'root';     
$cfg['Servers'][$i]['password']      = '';

把你的mysql密码填到$cfg['Servers'][$i]['password']      = ''; 单引号里边

2 搜索 $cfg['PmaAbsoluteUri'],将其设置为 phpMyAdmin 目录路径,如:http://localhost/phpMyAdmin/ ;

下面这两项项根据自己需要的编码修改(如果对数据库编码不是很熟悉的建议不要修改)
3 搜索 $cfg['DefaultLang'],将其设置为 zh-gb2312 ;
4 搜索 $cfg['DefaultCharset'],将其设置为 gb2312 ;

打开浏览器,输入:http://localhost/phpMyAdmin/,Apache 和 MySQL 均已启动,
如果出现如下页面则phpmyadmin安装完成并可以使用了
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134340474.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213014O-28.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

phpMyAdmin 的具体功能,请慢慢熟悉,这里不再赘述。

==============================
更多文章 php爱好者站 http://www.phpfans.net

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:第八节--访问方式Nächster Artikel:Apache2 httpd.conf 中文版