PHP Installation on Windows systems

System Requirements

  1. Apache 2.2 or later 
  2. MySQL 5.1 or later
  3. PHP 5.2.x

PHP 5.3.x is no longer available in a VC6 binary version. We have installed PHP 5.3.x (WAMP) on Windows 7 and worked correctly with the newer VC9 (PHP 5.3.x). But in this tutorial we will install PHP 5.2.x version.

Download and install PHP from http://windows.php.net/download/, you should download the newest VC6 x86 Thread Safe zip package (php-5.2.17-Win32-VC6-x86.zip).

Make sure you select the instalation folder to be "C:\PHP" and NOT "C:\Programe Files\PHP\", maybe it does not work nor convenient!

  1. Unzip 5.2.17-Win32-VC6-x86.zip to C:\PHP
  2. Rename C:\PHP\php.ini-recommended to php.ini
  3. Open php.ini in a text aditor
    - Find the line extension_dir = "./" and change to extension_dir = "C:\PHP\ext"
    - Uncomment the following rules:
       extension=php_gd2.dll
       extension=php_mbstring.dll
       extension=php_mysql.dll
       extension=php_mysqli.dll

    The first line makes the Image GD library of PHP accessible. The second makes mbstring accessible. The third and fourth make possible to MySQL database to use.

    - Change from "Off" to "On"
       short_open_tag = On
       display_errors = On

    short_open_tag
    tells PHP whether the short form (<? ?>) of PHP's open tag should be allowed.
    display_errors determines whether errors should be printed to the screen as part of the output or if they should be hidden from the user.
  4. Open Apache Conf File by "Start > Apache HTTP Server 2.2 > Configure Apache Server > Edit the Apache httpd.conf Configuration File" and add the following lines:
     LoadModule php5_module "C:/PHP/php5apache2_2.dll"
     AddType application/x-httpd-php .php
     PHPIniDir "C:/PHP"

    Add also index.php as a default page to following rule: 
    <IfModule dir_module>
         DirectoryIndex index.php index.html default.html
    </IfModule>
  5. Add C:/PHP to Windows Environment Variables
    - Right-click My Computer, and then click Properties.
    - Click the Advanced tab.
    - Click Environment variables.
    - Click System variable:
      Click PATH variable, and then click Edit to add ;C:/PHP at end of the rule.
  6. Restart your web server (Apache)
  7. Testing: create a new file phptest.php and save into your document root (d:/www or c:/public_html). The new file content shoul be:
    <?php
    phpinfo();
    ?>
  8. Go to localhost/phptest.php to see your PHP configuration or info page.

[ERROR]
<?php phpinfo(); ?> is working.
MySQL windows command and database connection is working.
MySQL browser or localhost connection doesn't work! WHY?

Internet Explorer cannot display the webpage
What you can try:

More information

[SOLVED]
Copy C:/PHP/libmysql.dll to your C:\Windows\System32\ or C:\WinNT\System\.

Where can I find my Windows\System directory?
Open DOS windows and run the following command:
C:\>echo %WINDIR%
C:\Windows    <---- this is your system directory