|CONFIGURING PHP 3 AND 4, MySQL 3.23, PHPMyAdmin, gd, Zend Optimizer FOR IIS 5.0/5.1 UNDER WINDOWS 2000/XP|
by Denis Bourdon
email@example.com - www.dbourdon.com/development
Last update: February, 8th 2003
Cette page est aussi disponible en français.
I. Installing PHP 3 and/or PHP 4
This configuration allows you to define PHP 3 and/or 4 as a mapping application under the web server IIS 5.0/5.1. This configuration has been tested under:
This configuration should work under Windows 2000 Datacenter, and even under IIS 4 and Windows NT 4.
Here are the versions of the software I installed:
I have installed both PHP 3 and 4 as most of providers still use PHP 3 but PHP 4 works good too. Here is how it works:
- First of all, download the versions you need of PHP on www.php.net (choose "downloads"); be sure to download the WIN32 distribution (it's a zip file)
- Go to the directory
C:\Inetpub\wwwroot or the directory where you run your "localhost" if you changed it
- Create new folders called - for example -
php3 for PHP 3
php for PHP 4, and go into it (if you want to put another name, there is no problem except that you must place the files in a directory above
- Extract the zip files in the fitting directories
- Copy the
php3.ini-dist and/or php.ini-dist file into
C:\winnt if you work under Windows 2000,
C:\windows under Windows XP, and rename it to
- For PHP 4 only, copy the file called php4ts.dll
(in the base directory where you unzipped PHP) into
- Start the Internet Service Manager
- For PHP 4 only, in the 'Properties' of your web site, under 'ISAPI Filters', add a new ISAPI filter. Enter 'PHP' as the 'Filter name' and '
C:\Inetpub\wwwroot\php\sapi\php4isapi.dll' as the 'Executable'
- Under 'Base Directory', click on the 'Configuration' button. Click on 'Add' in order to create a new entry to the Application Mappings; enter:
C:\Inetpub\wwwroot\php3\php.exe %s %s' (don't forget
%s %s) as the 'Executable' and '
.php3' as the 'Extension', leave 'Method exclusions' blank and 'Script engine' checked. If you want to use scripts with the extension '
.php' and if you have not installed PHP 4, I recommend that you do the same with the extension '
C:\Inetpub\wwwroot\php\sapi\php4isapi.dll' if you want to install it as an ISAPI or '
C:\Inetpub\wwwroot\php\php.exe %s %s' if you want to install it as a CGI engine (don't forget
%s %s) as the 'Executable' and '
.php' as the 'Extension', leave 'Method exclusions' blank and 'Script engine' checked. If you want to use scripts with the extension '
.php3' and if you have not installed PHP 3, I recommend that you do the same with the extension '
- Select 'Documents' and add the default documents '
index.php' and '
index.php3' whatever version(s) you install. This allows to launch these files if they exist while requesting the root of the current directory. It doesn't seem to work under Windows XP/IIS 5.1...
- Stop IIS completely (you would have to stop the IIS Administration service for that - stopping it through the Management Console isn't good enough, you can do it by typing '
net stop iisadmin' on a command prompt), and then start IIS again (you can do it by typing '
net start w3svc' on a command prompt). Under Windows XP, you don't need to do that unless you have installed the ISAPI filter
- Put a
.php3) file in '
C:\Inetpub\wwwroot\' like this
echo “Hello world!”;
and check if it works by browsing 'http://localhost/hello.php'
II. Installing MySQL
This configuration allows you to install MySQL and make it work with PHP 3 or PHP 4.
- First of all, download MySQL on www.mysql.com; be sure to download the WIN32 distribution (it's a zip file)
- Then run the setup and I recommend to leave 'C:\mysql' as the directory.
- For PHP 3 only, edit 'C:\WINNT\php3.ini' and search the string ';extension=php3_mysql.dll', erase ';' and save the file
- Go to 'C:\mysql\bin' and run 'mysqld-nt --install'; don't worry if nothing happens
- On a command prompt, type 'NET START mysql'
- Stop IIS completely (you would have to stop the IIS Administration service for that - stopping it through the Management Console isn't good enough, you can do it by typing 'net stop iisadmin' on a command prompt)
- Start IIS again (you can do it by typing 'net start w3svc' on a command prompt)
- To verify that MySql is running, type 'net start' on a command prompt and 'MySql' should appear
III. Installing PHPMyAdmin
- First of all, download PHPMyAdmin on www.phpwizard.net/phpMyAdmin/; note that both versions (with the extension '
.php' and '
.php'0 are absolutely identical, they use fonctionalities that are exactly the same between PHP 3 in PHP 4
- Install it in a subdirectory called 'phpMyAdmin' above the directory which corresponds to your 'localhost'
- Edit '
config.inc.php3' or '
config.inc.php'; fill the array
$cfgServers[$i] (between line 46 and 67 approximately) with your MySQL attributes as well as the
$cfgPmaAbsoluteUri (around line 36) with the URI of PHPMyAdmin on your server (typically '
- To install a foreign language dictionnary, edit the file '
libraries/select_lang.lib.php', search for your language, and then modify in the file 'config.inc.php' the variable
$cfgLang (after decommenting the line) with the chosen locale ('
fr' for French)
- Run it by browsing 'http://localhost/phpMyAdmin/'
IV. Installing gd for PHP 3 et for PHP 4
This configuration allows you to install the graphics library gd (which supports JPEG and PNG, and no longer GIF). Now (since PHP 4.0.3), the official PHP 4 includes a compiled version in the 'extensions' subfolder.
- Copy 'php3_gd.dll' and/or 'php_gd.dll' in your 'C:\winnt' directory
- Edit 'php3.ini' and/or 'php.ini' which are located in the 'C:\winnt' directory. Search for 'Windows Extensions' and a few lines above, delete ';' in front of 'extension=php_gd.dll' ou 'extension=php_gd.dll'
- Restart IIS
- Create in your 'localhost' directory a script called 'phpinfo.php' which contains only ; run it ('http://localhost/phpinfo.php') and check that there is a configuration about gd
V. Installing the Zend Optimizer for PHP 4
This configuration allows you to install the Zend Optimizer and make it work with PHP 4. It's really useful to speed up some PHP scripts
- First of all, download the Zend Optimizer v. 1.2.0 adapted to your PHP version at Zend
- Run the installation program
- Your 'php.ini' which is located in your 'C:\winnt' directory will be renamed to 'php.ini.old'. These two lines will be automatically added at the end of this file (you can check this):
zend_extension_ts="C:\Program Files\Zend\Zend Optimizer\ZendOptimizer.dll" zend_optimizer.optimization_level=15
- Restart IIS
- Create in your 'localhost' directory a script called 'phpinfo.php' which contains only
<?php phpinfo() ?> if you haven't already; run it ('http://localhost/phpinfo.php') and you would see 'with Zend Optimizer v0.99, Copyright (c) 1998-2000, by Zend Technologies' in the uppest table of the table