WinXP + Apache +PHP5 + MySQL + phpMyAdmin安装全功略

2018-09-07 13:49

阅读:344

  Ifinallygotthistowork,soIwillpostmyfindingshere.

//PHP5:WindowsbuildneedsaMySQLDLL
//PHP5.0doesntcomewithmysqlsupport...Youhavetogetthelibrariesyourself...

//PHP5Beta2
//Thefilephp_mysql.dllcomeswiththesesnapshots,aswellasanewversionoflibmySQL.dll,
//soIsuggestafullupgradetoBeta2insteadofjustextractingphp_mysql.dllforusewithBeta1.

--------------------------------------------------------
到下载下面三种软件,做好安装准备

apache_2.0.47-win32-x86-no_ssl.msi
mysql-4.0.14-win.zip
phpMyAdmin-2.5.3-rc1-php.zip
----------------------------------------------------------------------------------------------
PHP5Beta2:5.87MB(6,162,835bytes)
----------------------------------------------------------------------------------------------

<1>安装配置PHP
1.解压缩PHP压缩包到C:\php\

2.复制C:\php\目录下的php4ts.dll及C:\php\dlls目录下的所有文件到windows安装目录的系统文件夹里
(win9x/me是system目录,winNT,2k/winXP,2003是system32目录)

复制-dist到windows安装目录下(如:c:\windows),并将其改名为php.ini。用记事本打开,修改一下信息:
搜索extension_dir=./这行,并将其路径指到你的PHP目录下的extensions目录,比如:
extension_dir=C:\php\extensions

如若想支持更多模块,,搜索:
;WindowsExtensions
;NotethatMySQLandODBCsupportisnowbuiltin,sonodllisneededforit.

下面都用分号在前面注释掉了支持的扩展模块,如果你想PHP支持某个模块,请将前面的“;”去掉即可
修改完成后,保存php.ini,到此完成PHP的安装和配置。
我们在下面加入一行
extension=php_mysql.dll

//Note1:Theextensiondirneednotbe.\,asHermawanmentioned.Itworksfineformewiththeextensionssubdirwheretheotherextensionsarelocated.

//Note2:Thephp.inifileneednotbeintheApacheroot,aslarsmentioned.ItworksfineformeintheWindowsdir.

<2>安装Apach2
1.备份f文件。
2.用记事本打开C:\ProgramFiles\ApacheGroup\Apache2\conf\httpd.conf
找到:
#NameVirtualHost*
修改为:
NameVirtualHost127.0.0.1//或localhost
找到:
<VirtualHost127.0.0.1>
修改下面几行:
ServerAdmin(你刚才安装时候输入的管理员信箱)
DocumentRootC:\ProgramFiles\ApacheGroup\Apache2\htdocs
ServerNameApache2
ErrorLogC:\ProgramFiles\ApacheGroup\Apache2\logs\error_log
CustomLogC:\ProgramFiles\ApacheGroup\Apache2\logs\access_logcommon
</VirtualHost>
找到:
AddTypeapplication/x-tar.tgz
在下面添加以下两行:
AddTypeapplication/x-httpd-php.php
AddTypeimage/x-icon.ico
找到:
#LoadModulessl_modulemodules/mod_ssl.so
在下面添加一行:
LoadModulephp5_moduleC:\php\sapi\php4apache2.dll//这里php5_module是关键,如果php4_moduleapache就无法启动了
增加默认文件:
找到DirectoryIndex*这行,可以这样修改,添加默认的文件名:
DirectoryIndexindex.phpdefault.phpindex.htmindex.htmldefault.htmdefault.html
保存文件,重起apache服务器。

最后,在该文件末尾加上下面两行
ScriptAlias/php/c:/php/
Actionapplication/x-httpd-php/php/php.exe“

到此Apache的PHP环境已经完全建立了。

<3>测试:
用记事本新建个文件,写下下面几行,保存到C:\ProgramFiles\ApacheGroup\Apache2\htdocs目录下,这个目录就是你的站点跟目录,命名为phpinfo.php.然后在浏览器中输入就可以看到想尽的关于PHP的信息了。

phpinfo.php代码如下:
<?php

phpinfo();

?>

<4>安装mysql

1.按默认安装在C:\mysql

CopythefollowingfilestotheApachemodulesdirectory:

php\php4ts.dll
php\sapi\php4apache2.dll
php\dlls\iconv.dll

Ifanyofthesefilesaremissinginthemodulesdirectory,Apachewillfailtostart.

Besuretheextensioncanfindthefollowingfiles:

php_mysql.dll
iconv.dll
libmySQL.dll

Ifanyofthemcantbefound,Apachewillstartbutwillissueawarninglikethis:Unknown():Unabletoloaddynamiclibraryc\php\extensions\php_mysql.dll-Thespecifiedmodulecouldnotbefound.

php_mysql.dllshouldbeintheextensionsdirectory.

iconv.dllshouldbeintheApachemodulesdirectory.

libmySQL.dllmustbeeitherintheApacherootdirectoryortheWindowssystemdirectory.Iprefertheformerbecauseitscleaner,asotherapplicationsdontnecessarilyusethisMySQLlibraryversion.

Note3:BesuretousethelibmySQL.dllfilebundledwithPHP.Inmycase,tryingtousethelibmySQL.dllfromtheMySQL4.1alphapackageresultedinthiserrormessage:Unknown():Unabletoloaddynamiclibraryc:\php\extensions\php_mysql.dll-Thespecifiedprocedurecouldnotbefound.

StartApacheandeverythingshouldbefine.

2.运行C:\mysql\bin\winmysqladmin.exe设定user和password
3.运行mysql,测试一下
mysql>showdatabases;

+-----------+
Databases
+-----------+
mysql
test
+-----------+

如果出现以上画面,表明mysql已经安装成功;

2.更改MySQL系統之管理者密碼(新密碼的地方,換成您要設定的密碼)
mysql>UPDATEuserSETpassword=password(新密碼)whereuser=root;

3.编辑php5中的启动文件php.ini,将mysql和php5连接起来.
mysql.default_port=
mysql.default_host=
mysql.default_user=
mysql.default_password=
改为:
mysql.default_port=3306说明的是mysql的缺省端口一般为3306
mysql.default_host=localhost说明的是mysql的缺省主机名称
mysql.default_user=jinchao说明的是mysql的缺省的用户名(root是最高级用户)
mysql.default_password=666666设置管理员的口令

修改完后将apache重启,查看phpinfo页面.

<5>安装phpmyadmin

修改C:\ProgramFiles\ApacheGroup\Apache2\htdocs\phpMyAdmin\config.inc.php
查找以下这么一段:
$i=0;
//The$cfg[Servers]arraystartswith$cfg[Servers][1].Donotuse$cfg[Servers][0].
//Youcandisableaserverconfigentrybysettinghostto.
在这段之后再继续查找:

找到$cfg[Servers][$i][auth_type]=cookie;將『config』改為『cookie』或『http』
找到$cfg[Servers][$i][host]=localhost;视情况做相应修改
找到$cfg[Servers][$i][user]=root;视情况做相应修改
找到$cfg[Servers][$i][password]=;视情况做相应修改
找到$cfg[Servers][$i][port]=3306;视情况做相应修改


评论


亲,登录后才可以留言!