Apache2.2.4 + php5.2.5 + mysql5.0.45安装与详细配置
安装步骤:
1. 安装Apache
1) 欢迎界面
2)图2 授权协议,选择"I accept the terms in the license agreement"同意授权协议,然后点"Next"继续;
3)安装说明,直接点"Next"下一步; 图4
4)填写信息
"Network Domain"填写你的网络域名,这里我填写localhost。
"Server Name"填写你的服务器名,比如 localhost ,也就是主机名。
"Administrator's Email Address"填写系统管理员的联系电子邮件地址,比如 admin@web.com 。
说明:上述三条信息仅供参考,其中联系电子邮件地址会在当系统故障时提供给访问者,三条信息均可任意填写,无效的也行。
下面有两个选择:
第一个是为系统所有用户安装,使用默认的80端口,并作为系统服务自动启动;
另外一个是仅为当前用户安装,使用端口8080,手动启动。
一般选择第一个"for All Users, on Port 80, as a Service Recommended"。
我选的是第一个,按"Next"继续。
说明:如果你的电脑上有类似IIS等占用80的web server 建议必须停掉服务。
5)选择安装类型,typical是默认安装;custom是自定义安装;我这里选择Custom有更多可选项。按"Next"继续; 图6
6)更改路径:你自行选取了,一般建议不要安装在操作系统所在盘,免得操作系统坏了之后,还原操作把Apache配置文件也清除了。
点"Next"继续;
10)在浏览器的地址栏输入http://127.0.0.1(如果用的8080端口,输入http://127.0.0.1:8080)。
至此,Apache安装完毕;
2. 安装Mysql
1)打开下载的mysql安装文件mysql-5.0.45-win32.zip,双击解压缩,运行"setup.exe",安装开始,如下图(以下步骤中不特别说明的请按默认安装即可) 图11
按[Next]继续
安装类型说明(3种)
Typical(典型安装)-安装常用功能,推荐通常使用。
Compact(最小安装)-安装所有功能,磁盘空间使用最大。
Custom(选择安装)-可根据需要定制安装,适合熟练用户使用。
根据需要选择适合自己的安装类型,这里选择typical典型安装,按[Next]继续, 图15
此步骤如果不选择"Configure the MySQL Server now"(配置MySQL服务)安装可以告一段落,直接按[Finish]结束。这里我们继续选择"Configure the MySQL Server now",按[Finish]继续
标准配置说明
Detailed Configuration(细化配置)-可以根据本机器来安装创建优化的数据库
a.Developer Machine(开发测试类,mysql占用很少资源)
b.Server Machine(服务器类型,mysql占用较多资源)
c.Dedicated MySQL Server Machine(专门的数据库服务器,mysql占用所有可用资源
1.Multifunctional Database(通用多功能型,好)
2.Transactional Database Only(服务器类型,专注于事务处理,一般)
3.Non-Transactional Database Only(非事务处理型,较简单,主要做一些监控、记数用,对MyISAM数据类型的支持仅限于non-transactional)。
Standard Configuration(标准配置)-创建一个通用的数据库配置,此配置可手工调整。
这里选择"Standard Configuration",按[Next]继续,
安装MySQL服务到Windows服务中,服务名称可以自己命名或默认(第一次选默认)
问题说明:这里的Serice Name会写入到Windows服务中,如果Windows服务中已经有了此名称,则安装不成功,请保证此名称唯一。
这里选择"Install As Windows Service",按[Next]继续,
设置MySQL的root密码(问题说明:如果不选中"Enable root access from remote machines"选项,root帐户不能用于远程访问),选择"Enable root access from remote machines"选项,按[NEXT]继续, 问题说明:如果不成功,请检查防火墙,关闭防火墙或一些类似防火墙的软件等。
按[Execute]继续,
MySQL安装配置完成。
说明:这一步骤可以会出现窗口提示,点击重试就可以了。(原因我不大清楚,我装的时候几乎总是出提示,点重试就可以了。汗!)
3.PHP 配置
1) 把php5.2.5的压缩包解压缩到你向放置的地方,我的路径是:d:\php (下面步骤也安装我的路径描述)
2)解压缩pecl包,把解压出来的文件全部复制到d:\php\ext下
3) 在d:\php 下复制一份php.ini-recommended,命名为php.ini,就放置在当前目录下
4)用编辑器(如editplus)编辑php.ini,做如下修改:
a. 查找short_open_tag
把short_open_tag = Off修改成short_open_tag = On
b. 查找error_reporting = E_ALL
把error_reporting = E_ALL注释掉 ;error_reporting = E_ALL,并在后面另起一行添加:error_reporting = E_ALL & ~E_NOTICE
c. 查找display_errors = Off
把display_errors = Off修改成display_errors = On
d. 查找extension_dir = "./"
把extension_dir = "./"修改成extension_dir = "d:\php\ext"
e. 找到:
......
;extension=php_gmp.dll
;extension=php_ifx.dll
;extension=php_imap.dll
......
所属区域
把你要加载的拓展前面的注释";"去掉,我加载的拓展:
extension=php_mbstring.dll
extension=php_mcrypt.dll
extension=php_curl.dll
extension=php_gd2.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo.dll
extension=php_pdo_mysql.dll
说明:如果要加载:
extension=php_mcrypt.dll
extension=php_mysql.dll
最好把d:\php下的libmysql.dll、libmcrypt.dll、libeay32.dll、libmhash.dll、libswish-e.dll都copy到c:\windows\system32 (xp and 2003)下。
f. 查找;session.save_path = "/tmp"
在其后面另起一行添加session.save_path = "d:\php\session",同时在d:\php 下创建目录session(这个步骤是为php设置session文件存储路径)
(注意以上进行步骤后,记得要保存哦!)
(养成良好的习惯,我的习惯每做一次修改必ctrl+s(保存)):)
PHP配置告一段落。
4. 配置Apache (我的Apache安装到d:\Apache2.2,以下按照我的安装路径为准)
1)用编辑器打开d:\Apache2.2\conf\httpd.conf
2) 查找DocumentRoot "D:/Apache2.2/htdocs"
将DocumentRoot "D:/Apache2.2/htdocs"修改为DocumentRoot "E:\webapps" (我的web本地开发环境的根是E:\webapps),这里是修改Apache的默认根目录,依个人习惯、喜好不同而定。
3)查找<Directory "D:/Apache2.2/htdocs">
将<Directory "D:/Apache2.2/htdocs">修改为<Directory "E:\webapps">
4)查找DirectoryIndex index.htm
将DirectoryIndex index.htm 修改成DirectoryIndex index.html index.htm index.php,这里是设置Apache默认首页文件名,它们的优先级是按照顺序而定。
5)查找#Include conf/extra/httpd-autoindex.conf
将#Include conf/extra/httpd-autoindex.conf修改成Include conf/extra/httpd-autoindex.conf
6)查找#Include conf/extra/httpd-vhosts.conf
将#Include conf/extra/httpd-vhosts.conf修改成Include conf/extra/httpd-vhosts.conf
7)查找#Include conf/extra/httpd-autoindex.conf
将#Include conf/extra/httpd-autoindex.conf修改成Include conf/extra/httpd-autoindex.conf
8)查找#Include conf/extra/httpd-default.conf
将#Include conf/extra/httpd-default.conf修改成Include conf/extra/httpd-default.conf
9)查找#LoadModule ssl_module modules/mod_ssl.so
在其后另起一行,添加如下:
LoadModule php5_module "D:/php/php5apache2_2.dll"
PHPiniDir "D:/php"
AddType application/x-httpd-php .php
保存(ctrl+s)
10)双击右下角的 点击 stop停止Apache服务
等Apache停止后 再次点击 start开始Apache服务
11)在E:\webapps下 建一个名字为info.php的文件,文件内容:
<?php
phpinfo();
?>
浏览器打开:http://127.0.0.1/info.php,测试。
北京新海淀计算机学校官方网址:www.hdpcschool.com ,报名、咨询!



