WinXP + Apache +PHP5 + MySQL + phpMyAdmin安装全功略
程序员文章站
2022-03-23 15:38:49
i finally got this to work, so i will pos...
i finally got this to work, so i will post my findings here.
//php 5 : windows build needs a mysql dll
//php 5.0 doesn't come with mysql support... you have to get the librariesyourself...
//i think u can get them from mysql.com
// php 5 beta 2
//the file php_mysql.dll comes with these snapshots, as well as a new version of libmysql.dll,
//so i suggest a full upgrade to beta 2 instead of just extracting php_mysql.dll for use with beta 1.
--------------------------------------------------------
到 www.jetdown.com 下载下面三种软件,做好安装准备
apache_2.0.47-win32-x86-no_ssl.msi
mysql-4.0.14-win.zip
phpmyadmin-2.5.3-rc1-php.zip
----------------------------------------------------------------------------------------------
php 5 beta 2 http://snaps.php.net/win32/php5-win32-latest.zip size:5.87 mb (6,162,835 bytes)
----------------------------------------------------------------------------------------------
<1>安装配置php
1.解压缩php压缩包到c:\php\
2.复制c:\php\目录下的php4ts.dll及c:\php\dlls目录下的所有文件到windows安装目录的系统文件夹里
(win9x/me是system目录,winnt,2k/winxp,2003是system32目录)
复制c:\php\php.ini-dist到windows安装目录下(如:c:\windows),并将其改名为php.ini。用记事本打开,修改一下信息:
搜索extension_dir = ./ 这行,并将其路径指到你的php目录下的extensions目录,比如:
extension_dir = c:\php\extensions
如若想支持更多模块,,搜索:
;windows extensions
;note that mysql and odbc support is now built in, so no dll is needed for it.
下面都用分号在前面注释掉了支持的扩展模块,如果你想php支持某个模块,请将前面的“;”去掉即可
修改完成后,保存php.ini,到此完成php的安装和配置。
我们在下面加入一行
extension=php_mysql.dll
//note 1: the extension dir need not be ".\", as hermawan mentioned. it works fine for me with the extensions subdir where the other extensions are located.
//note 2: the php.ini file need not be in the apache root, as lars mentioned. it works fine for me in the windows dir.
<2>安装apach2
1.备份 c:\program files\apache group\apache2\conf\httpd.conf 文件。
2.用记事本打开c:\program files\apache group\apache2\conf\httpd.conf
找到:
#namevirtualhost *
修改为:
namevirtualhost 127.0.0.1 //或localhost
找到:
<virtualhost 127.0.0.1>
修改下面几行:
serveradmin (你刚才安装时候输入的管理员信箱)
documentroot c:\program files\apache group\apache2\htdocs
servername apache2
errorlog c:\program files\apache group\apache2\logs\error_log
customlog c:\program files\apache group\apache2\logs\access_log common
</virtualhost>
找到:
addtype application/x-tar .tgz
在下面添加以下两行:
addtype application/x-httpd-php .php
addtype image/x-icon .ico
找到:
#loadmodule ssl_module modules/mod_ssl.so
在下面添加一行:
loadmodule php5_module c:\php\sapi\php4apache2.dll //这里php5_module是关键,如果php4_module apache就无法启动了
增加默认文件:
找到directoryindex * 这行,可以这样修改,添加默认的文件名:
directoryindex index.php default.php index.htm index.html default.htm default.html
保存文件,重起apache服务器。
最后,在该文件末尾加上下面两行
scriptalias /php/ "c:/php/"
action application/x-httpd-php "/php/php.exe“
到此apache的php环境已经完全建立了。
<3>测试:
用记事本新建个文件,写下下面几行,保存到c:\program files\apache group\apache2\htdocs目录下,这个目录就是你的站点跟目录,命名为phpinfo.php.然后在浏览器中输入http://localhost/phpinfo.php 就可以看到想尽的关于php的信息了。
phpinfo.php代码如下:
<?php
phpinfo();
?>
<4>安装mysql
1.按默认安装在c:\mysql
copy the following files to the apache modules directory:
php\php4ts.dll
php\sapi\php4apache2.dll
php\dlls\iconv.dll
if any of these files are missing in the modules directory, apache will fail to start.
be sure the extension can find the following files:
php_mysql.dll
iconv.dll
libmysql.dll
if any of them can't be found, apache will start but will issue a warning like this: "unknown(): unable to load dynamic library 'c\php\extensions\php_mysql.dll" - the specified module could not be found."
php_mysql.dll should be in the extensions directory.
iconv.dll should be in the apache modules directory.
libmysql.dll must be either in the apache root directory or the windows system directory. i prefer the former because it's cleaner, as other applications don't necessarily use this mysql library version.
note 3: be sure to use the libmysql.dll file bundled with php. in my case, trying to use the libmysql.dll from the mysql 4.1 alpha package resulted in this error message: "unknown(): unable to load dynamic library 'c:\php\extensions\php_mysql.dll" - the specified procedure could not be found."
start apache and everything should be fine.
2.运行c:\mysql\bin\winmysqladmin.exe 设定user 和password
3.运行mysql,测试一下
mysql> show databases;
+-----------+
| databases |
+-----------+
| mysql |
| test |
+-----------+
如果出现以上画面,表明mysql已经安装成功;
2.更改mysql系統之管理者密碼(新密碼的地方,換成您要設定的密碼)
mysql> update user set password=password('新密碼') where user='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:\program files\apache group\apache2\htdocs\phpmyadmin\config.inc.php
查找以下这么一段:
$i = 0;
// the $cfg['servers'] array starts with $cfg['servers'][1]. do not use $cfg['servers'][0].
// you can disable a server config entry by setting host to ''.
在这段之后再继续查找:
找到 $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'; 视情况做相应修改
//php 5 : windows build needs a mysql dll
//php 5.0 doesn't come with mysql support... you have to get the librariesyourself...
//i think u can get them from mysql.com
// php 5 beta 2
//the file php_mysql.dll comes with these snapshots, as well as a new version of libmysql.dll,
//so i suggest a full upgrade to beta 2 instead of just extracting php_mysql.dll for use with beta 1.
--------------------------------------------------------
到 www.jetdown.com 下载下面三种软件,做好安装准备
apache_2.0.47-win32-x86-no_ssl.msi
mysql-4.0.14-win.zip
phpmyadmin-2.5.3-rc1-php.zip
----------------------------------------------------------------------------------------------
php 5 beta 2 http://snaps.php.net/win32/php5-win32-latest.zip size:5.87 mb (6,162,835 bytes)
----------------------------------------------------------------------------------------------
<1>安装配置php
1.解压缩php压缩包到c:\php\
2.复制c:\php\目录下的php4ts.dll及c:\php\dlls目录下的所有文件到windows安装目录的系统文件夹里
(win9x/me是system目录,winnt,2k/winxp,2003是system32目录)
复制c:\php\php.ini-dist到windows安装目录下(如:c:\windows),并将其改名为php.ini。用记事本打开,修改一下信息:
搜索extension_dir = ./ 这行,并将其路径指到你的php目录下的extensions目录,比如:
extension_dir = c:\php\extensions
如若想支持更多模块,,搜索:
;windows extensions
;note that mysql and odbc support is now built in, so no dll is needed for it.
下面都用分号在前面注释掉了支持的扩展模块,如果你想php支持某个模块,请将前面的“;”去掉即可
修改完成后,保存php.ini,到此完成php的安装和配置。
我们在下面加入一行
extension=php_mysql.dll
//note 1: the extension dir need not be ".\", as hermawan mentioned. it works fine for me with the extensions subdir where the other extensions are located.
//note 2: the php.ini file need not be in the apache root, as lars mentioned. it works fine for me in the windows dir.
<2>安装apach2
1.备份 c:\program files\apache group\apache2\conf\httpd.conf 文件。
2.用记事本打开c:\program files\apache group\apache2\conf\httpd.conf
找到:
#namevirtualhost *
修改为:
namevirtualhost 127.0.0.1 //或localhost
找到:
<virtualhost 127.0.0.1>
修改下面几行:
serveradmin (你刚才安装时候输入的管理员信箱)
documentroot c:\program files\apache group\apache2\htdocs
servername apache2
errorlog c:\program files\apache group\apache2\logs\error_log
customlog c:\program files\apache group\apache2\logs\access_log common
</virtualhost>
找到:
addtype application/x-tar .tgz
在下面添加以下两行:
addtype application/x-httpd-php .php
addtype image/x-icon .ico
找到:
#loadmodule ssl_module modules/mod_ssl.so
在下面添加一行:
loadmodule php5_module c:\php\sapi\php4apache2.dll //这里php5_module是关键,如果php4_module apache就无法启动了
增加默认文件:
找到directoryindex * 这行,可以这样修改,添加默认的文件名:
directoryindex index.php default.php index.htm index.html default.htm default.html
保存文件,重起apache服务器。
最后,在该文件末尾加上下面两行
scriptalias /php/ "c:/php/"
action application/x-httpd-php "/php/php.exe“
到此apache的php环境已经完全建立了。
<3>测试:
用记事本新建个文件,写下下面几行,保存到c:\program files\apache group\apache2\htdocs目录下,这个目录就是你的站点跟目录,命名为phpinfo.php.然后在浏览器中输入http://localhost/phpinfo.php 就可以看到想尽的关于php的信息了。
phpinfo.php代码如下:
<?php
phpinfo();
?>
<4>安装mysql
1.按默认安装在c:\mysql
copy the following files to the apache modules directory:
php\php4ts.dll
php\sapi\php4apache2.dll
php\dlls\iconv.dll
if any of these files are missing in the modules directory, apache will fail to start.
be sure the extension can find the following files:
php_mysql.dll
iconv.dll
libmysql.dll
if any of them can't be found, apache will start but will issue a warning like this: "unknown(): unable to load dynamic library 'c\php\extensions\php_mysql.dll" - the specified module could not be found."
php_mysql.dll should be in the extensions directory.
iconv.dll should be in the apache modules directory.
libmysql.dll must be either in the apache root directory or the windows system directory. i prefer the former because it's cleaner, as other applications don't necessarily use this mysql library version.
note 3: be sure to use the libmysql.dll file bundled with php. in my case, trying to use the libmysql.dll from the mysql 4.1 alpha package resulted in this error message: "unknown(): unable to load dynamic library 'c:\php\extensions\php_mysql.dll" - the specified procedure could not be found."
start apache and everything should be fine.
2.运行c:\mysql\bin\winmysqladmin.exe 设定user 和password
3.运行mysql,测试一下
mysql> show databases;
+-----------+
| databases |
+-----------+
| mysql |
| test |
+-----------+
如果出现以上画面,表明mysql已经安装成功;
2.更改mysql系統之管理者密碼(新密碼的地方,換成您要設定的密碼)
mysql> update user set password=password('新密碼') where user='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:\program files\apache group\apache2\htdocs\phpmyadmin\config.inc.php
查找以下这么一段:
$i = 0;
// the $cfg['servers'] array starts with $cfg['servers'][1]. do not use $cfg['servers'][0].
// you can disable a server config entry by setting host to ''.
在这段之后再继续查找:
找到 $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'; 视情况做相应修改
推荐阅读
-
Slaris10系统下编译安装apache2、mysql5和php5
-
WinXP + Apache +PHP5 + MySQL + phpMyAdmin安装全功略_PHP编程
-
php环境配置 php5 MySQL5 apache2 phpmyadmin安装与配置图文教程
-
Win XP下全新安装Apache2,PHP5,MYSQL5
-
WinXP + Apache +PHP5 + MySQL + phpMyAdmin安装全功略_PHP编程
-
php环境配置 php5 mysql5 apache2 phpmyadmin安装与配置
-
Apache和PHP安装 WINXP下apache+php4+mysql
-
腾讯云ubuntu下安装php5 apache2 mysql的命令分享
-
XP下安装Apache2 PHP5 MYSQL5 Zend
-
Win2003下APACHE + PHP5 + MYSQL4 + PHPMYADMIN的简易安装配置