WinXP + Apache +PHP5 + MySQL + phpMyAdmin°²×°È«¹¦ÂÔ

5年以前  |  阅读数:739 次  |  编程语言:PHP 

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 ÏÂÔØÏÂÃaeÈýÖÖÈi¼þ,×oºÃ°²×°×¼±¸

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>°²×°ÅaÖÃPHP ¡¡¡¡1.½aѹËoPHPѹËo°uµ½C:\php\

2.¸´ÖÆC:\php\Ŀ¼ÏµÄphp4ts.dll¼°C:\php\dllsĿ¼ÏµÄËuÓÐÎļþµ½windows°²×°Ä¿Â¼µÄϵͳÎļþ¼ÐÀi
(win9x/meÊÇsystemĿ¼£¬winNT,2k/winXP,2003ÊÇsystem32Ŀ¼)

¸´ÖÆC:\php\php.ini-distµ½windows°²×°Ä¿Â¼Ï£¨È磺c:\windows£(C)£¬²¢½«Æa¸ÄÃuΪphp.ini¡£ÓüÇʱ¾´o¿ª£¬ÐÞ¸ÄÒ»ÏÂÐÅÏ¢£º
¡¡¡¡ËÑË÷extension_dir = ./ ÕaÐУ¬²¢½«ÆaÂ*¾¶Ö¸µ½ÄaµÄPHPĿ¼ÏµÄextensionsĿ¼£¬±ÈÈ磺
¡¡¡¡extension_dir = C:\php\extensions

¡¡¡¡ÈçÈoÏeÖ§³Ö¸u¶aÄ£¿e£¬£¬ËÑË÷£º
;Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it.

ÏÂÃae¶¼ÓÃ*ÖºÅÔÚÇ°Ãae×¢Ê͵oÁËÖ§³ÖµÄÀ(C)չģ¿e£¬Èç¹uÄaÏePHPÖ§³Öij¸oÄ£¿e£¬Çe½«Ç°ÃaeµÄ¡°;¡±È¥µo¼´¿É
ÐÞ¸ÄÍe³Éºo,±£´aephp.ini£¬µ½´ËÍe³ÉPHPµÄ°²×°ºÍÅaÖá£
ÎÒÃÇÔÚÏÂÃae¼ÓÈeÒ»ÐÐ
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.ÓüÇʱ¾´o¿ªC:\Program Files\Apache Group\Apache2\conf\httpd.conf ÕÒµ½£º #NameVirtualHost * ÐÞ¸ÄΪ£º NameVirtualHost 127.0.0.1¡¡//»olocalhost ÕÒµ½£º ÐÞ¸ÄÏÂÃae¼¸ÐУº ServerAdmin (Äa¸Õ²Å°²×°Ê±ºoÊaÈeµÄ¹ÜÀiÔ±ÐÅÏa) 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 ÕÒµ½£º AddType application/x-tar .tgz ÔÚÏÂÃaeÌi¼ÓÒÔÏÂÁ½ÐУº AddType application/x-httpd-php .php AddType image/x-icon .ico ÕÒµ½£º #LoadModule ssl_module modules/mod_ssl.so ÔÚÏÂÃaeÌi¼ÓÒ»ÐУº LoadModule php5_module C:\php\sapi\php4apache2.dll //ÕaÀiphp5_moduleÊǹؼu£¬Èç¹uphp4_module apache¾ÍÎÞ*¨Æo¶¯ÁË Ôo¼ÓĬÈÏÎļþ£º ÕÒµ½DirectoryIndex * ÕaÐУ¬¿ÉÒÔÕaÑuÐ޸ģ¬Ìi¼ÓĬÈϵÄÎļþÃu£º DirectoryIndex index.php default.php index.htm index.html default.htm default.html ±£´aeÎļþ£¬ÖØÆðapache*þÎñÆ÷¡£

×iºo£¬ÔÚ¸ÃÎļþÄ(C)β¼ÓÉÏÏÂÃaeÁ½ÐÐ
ScriptAlias /php/ "c:/php/"
Action application/x-httpd-php "/php/php.exe¡°

µ½´ËApacheµÄPHP»*¾³ÒѾ­ÍeÈ«½¨Á¢ÁË¡£

<3>²aÊÔ£º ¡¡¡¡ÓüÇʱ¾Ð½¨¸oÎļþ£¬Ð´ÏÂÏÂÃae¼¸ÐУ¬±£´aeµ½C:\Program Files\Apache Group\Apache2\htdocsĿ¼Ï£¬Õa¸oĿ¼¾ÍÊÇÄaµÄÕ¾µa¸uĿ¼£¬ÃuÃuΪphpinfo.php.È»ºoÔÚa¯ÀÀÆ÷ÖÐÊaÈehttp://localhost/phpinfo.php ¾Í¿ÉÒÔ¿´µ½Ïe¾¡µÄ¹ØÓÚPHPµÄÐÅÏ¢ÁË¡£

phpinfo.php´uÂeÈçÏ£º
<?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 Ée¶¨user ºÍpassword
3.ÔËÐÐmysql,²aÊÔÒ»ÏÂ
mysql> show databases;

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

Èç¹u³oÏÖÒÔÉÏ»­Ãae£¬±iÃ÷mysqlÒѾ­°²×°³É¹¦£»

2.¸u¸ÄMySQLϵ½yÖ®¹ÜÀiÕßÃÜ´a(ÐÂÃÜ´aµÄµØ*½£¬"Q³ÉÄuÒªÔO¶¨µÄÃÜ´a)
mysql> UPDATE user SET password=password('ÐÂÃÜ´a') where user='root';

3.±a¼­php5ÖеÄÆo¶¯Îļþphp.ini,½«mysqlºÍphp5Á¬½ÓÆðÀ´.
mysql.default_port=
mysql.default_host=
mysql.default_user=
mysql.default_password=
¸ÄΪ£º
mysql.default_port=3306 ˵Ã÷µÄÊÇmysqlµÄȱʡ¶Ë¿ÚÒ»°aΪ3306
mysql.default_host=localhost ˵Ã÷µÄÊÇmysqlµÄȱʡÖ÷»uÃu³Æ
mysql.default_user=jinchao ˵Ã÷µÄÊÇmysqlµÄȱʡµÄÓû§Ãu(rootÊÇ×i¸ß¼¶Óû§)
mysql.default_password=666666 ÉeÖùÜÀiÔ±µÄ¿ÚÁi

ÐÞ¸ÄÍeºo½«apacheÖØÆo,²e¿´phpinfoÒ³Ãae.

<5>°²×°phpmyadmin

ÐÞ¸Ä C:\Program Files\Apache Group\Apache2\htdocs\phpMyAdmin\config.inc.php
²eÕÒÒÔÏÂÕaôһ¶Î£º
$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 ''.
ÔÚÕa¶ÎÖ®ºoÔÙ¼ÌÐø²eÕÒ£º

ÕÒµ½ $cfg['Servers'][$i]['auth_type'] = 'cookie'; Œ¢ ¡º config ¡»¸Äže ¡º cookie ¡»»o ¡º http ¡»
ÕÒµ½$cfg['Servers'][$i]['host'] = 'localhost'; ÊÓÇe¿o×oÏaÓ¦ÐÞ¸Ä
ÕÒµ½$cfg['Servers'][$i]['user'] = 'root'; ÊÓÇe¿o×oÏaÓ¦ÐÞ¸Ä
ÕÒµ½$cfg['Servers'][$i]['password'] = ''; ÊÓÇe¿o×oÏaÓ¦ÐÞ¸Ä
ÕÒµ½$cfg['Servers'][$i]['port'] = '3306'; ÊÓÇe¿o×oÏaÓ¦ÐÞ¸Ä

 相关文章:
PHP分页显示制作详细讲解
SSH 登录失败:Host key verification failed
获取IMSI
将二进制数据转为16进制以便显示
获取IMEI
文件下载
贪吃蛇
双位运算符
PHP自定义函数获取搜索引擎来源关键字的方法
Java生成UUID
发送邮件
年的日历图
提取后缀名
在Zeus Web Server中安装PHP语言支持
让你成为最历害的git提交人
Yii2汉字转拼音类的实例代码
再谈PHP中单双引号的区别详解
指定应用ID以获取对应的应用名称
Python 2与Python 3版本和编码的对比
php封装的page分页类完整实例