SoFunction
Updated on 2025-04-08

WinXP + Apache + PHP5 + MySQL + phpMyAdmin installation guide

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  

// PHP 5 Beta 2  
//The file php_mysql.dll comes with these snapshots, as well as a new version of ,  
//so I suggest a full upgrade to Beta 2 instead of just extracting php_mysql.dll for use with Beta 1. 

-------------------------------------------------------- 
Download the following three software and prepare for installation

apache_2.0.47-win32-x86-no_ssl.msi 
mysql-4.0. 
phpMyAdmin-2.5. 
---------------------------------------------------------------------------------------------- 
PHP 5 Beta 2 /win32/ size:5.87 MB (6,162,835 bytes) 
---------------------------------------------------------------------------------------------- 

<1>Installing and configuring PHP
1. Decompress the PHP compression package to C:\php\

2. Copy all files in the C:\php\ directory and C:\php\dlls directory to the system folder of the Windows installation directory.
(win9x/me is the system directory, winNT, 2k/winXP, 2003 is the system32 directory)

Copy C:\php\-dist to the windows installation directory (such as: c:\windows) and change it to. Open it with notepad and modify the information:
Search for extension_dir = ./, and point its path to the extensions directory under your PHP directory, for example:
extension_dir = C:\php\extensions 

If you want to support more modules, search:
;Windows Extensions 
;Note that MySQL and ODBC support is now built in, so no dll is needed for it. 

The following are all commented out the supported extension modules in front of the previous section. If you want PHP to support a certain module, please remove the previous ";"
After the modification is completed, save it and complete the installation and configuration of PHP.
Let's add a line below
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  file need not be in the Apache root, as lars mentioned. It works fine for me in the Windows dir. 

<2>Install Apache2
1. Backup C:\Program Files\Apache Group\Apache2\conf\ File.
2. Open C:\Program Files\Apache Group\Apache2\conf\
turn up:
#NameVirtualHost * 
Modified to:
NameVirtualHost 127.0.0.1 //or localhost
turn up:
<VirtualHost 127.0.0.1> 
Modify the following lines:
ServerAdmin (The administrator mailbox you entered when you installed it just now)
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> 
turn up:
AddType application/x-tar .tgz 
Add the following two lines below:
AddType application/x-httpd-php .php 
AddType image/x-icon .ico 
turn up:
#LoadModule ssl_module modules/mod_ssl.so 
Add a line below:
LoadModule php5_module C:\php\sapi\//Here php5_module is the key. If php4_module apache cannot be started
Add default file:
Find DirectoryIndex * line, you can modify it like this and add the default file name:
DirectoryIndex       
Save the file and restart the apache server.

Finally, add the following two lines at the end of the file
ScriptAlias /php/ "c:/php/" 
Action application/x-httpd-php "/php/“ 

At this point, Apache's PHP environment has been fully established.

<3>Test:
Create a new file with notepad, write down the following lines, and save it to the C:\Program Files\Apache Group\Apache2\htdocs directory. This directory is your site and directory, named. Then enter http://localhost/ in the browser and you can see all the information about PHP.

The code is as follows:
<?php 

phpinfo(); 

?>  

<4>Install mysql

1. Install it in C:\mysql by default

Copy the following files to the Apache modules directory: 

php\ 
php\sapi\ 
php\dlls\ 

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  
 
 

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. 

 should be in the Apache modules directory. 

 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  file bundled with PHP. In my case, trying to use the  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. Run C:\mysql\bin\ Set user  and password
3. Run mysql and test it
mysql> show databases; 

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

If the above screen appears, it means that mysql has been installed successfully;

2. Change the administrator password of the MySQL system (the place where the new password is changed to the password you want to set)
mysql> UPDATE user SET password=password('new password') where user='root';

3. Edit the startup file in php5 and connect mysql and php5.
mysql.default_port= 
mysql.default_host= 
mysql.default_user= 
mysql.default_password= 
Change to:
mysql.default_port=3306 It means that the default port of mysql is generally 3306
mysql.default_host=localhost It indicates the default host name of mysql
mysql.default_user=jinchao Indicates the default user name of mysql (root is the highest-level user)
mysql.default_password=666666 Set the administrator's password

After modification, restart apache and view the phpinfo page.

<5>Install phpmyadmin

Modify C:\Program Files\Apache Group\Apache2\htdocs\phpMyAdmin\
Find the following paragraph:
$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 ''. 
Continue to search after this section:

Find $cfg['Servers'][$i]['auth_type'] = 'cookie'; Change   『  config  』 to   『  cookie  』 or   『 http  』
Find $cfg['Servers'][$i]['host'] = 'localhost'; Make corresponding changes depending on the situation.
Find $cfg['Servers'][$i]['user'] = 'root'; Make corresponding changes depending on the situation.
Find $cfg['Servers'][$i]['password'] = ''; Make corresponding changes depending on the situation.
Find $cfg['Servers'][$i]['port'] = '3306'; Make corresponding changes depending on the situation.