Setup Apache, PHP, and MySQL

(Change this top section to have the new files and instructions)

  1. Download the software you need:
    Apache v2.0.59 or v2.2.4
    PHP v5.2.1 Installer or v5.2.6
    (PHP) PECL v5.2.1 Win32 binaries or v5.2.6
    MySQL Server (v5.0.37)
    MySQL GUI Tools (v5.0 r11a)
    Note: Apache 2.2.21 seems to works with PHP 5.2.17 VC6 Thread Safe.

  2. Install the software:
    Apache
    PHP Installer
    MySQL Server
    MySQL GUI Tools

  3. Extract the contents of the PHP PECL zip file to the C:\Program Files\PHP\ext directory.

  4. Make sure you have the following settings in the C:\Program Files\PHP\php.ini file:
    extension_dir="C:/Program Files/PHP/ext"
    extension=php_mysql.dll
    extension=php_mysqli.dll
    and any other extensions you think you will need.
    Also, if there is a version of the php.ini file in the windows directory, remove it.

  5. In your Apache httpd.conf file...
    Change the DirectoryIndex line to include index.php:
    DirectoryIndex index.php index.shtml index.html index.html.var index.htm default.htm

    Change the DocumentRoot line to be your web site home directory:
    Ex.: DocumentRoot "C:/www"
    I changed my DocumentRoot so I would not have to always navigate a through a the directory tree to get to my Web documents.

    Change the *Directory ...* line to match the DocumentRoot you set above:
    *Directory "C:/www"*
    where the *'s are the 'less than' and 'greater than' symbols respectively.

    For Apache to actually run PHP you need to set up PHP as a Handler for .php files.
    Add the following to the bottom of the httpd.conf file:
    #
    LoadModule php5_module "c:/php/php5apache2.dll"
    AddHandler application/x-httpd-php .php

    # configure the path to php.ini
    PHPIniDir "C:/php"

    where "c:/php/php5apache2.dll" is the existing DLL in your PHP directory.


Original (old) instructions...

Setup Apache, PHP, and MySQL

  1. Download the software you need:
    Apache v2.0.59 or v2.2.4
    PHP v5.2.1 Installer or v5.2.6
    (PHP) PECL v5.2.1 Win32 binaries or v5.2.6
    MySQL Server (v5.0.37)
    MySQL GUI Tools (v5.0 r11a)
    Note: Apache 2.2.21 seems to works with PHP 5.2.17 VC6 Thread Safe.

  2. Install the software:
    Apache
    PHP Installer
    MySQL Server
    MySQL GUI Tools

  3. Extract the contents of the PHP PECL zip file to the C:\Program Files\PHP\ext directory.

  4. Make sure you have the following settings in the C:\Program Files\PHP\php.ini file:
    extension_dir="C:/Program Files/PHP/ext"
    extension=php_mysql.dll
    extension=php_mysqli.dll
    and any other extensions you think you will need.
    Also, if there is a version of the php.ini file in the windows directory, remove it.

  5. In your Apache httpd.conf file...
    Change the DirectoryIndex line to include index.php:
    DirectoryIndex index.php index.shtml index.html index.html.var index.htm default.htm

    Change the DocumentRoot line to be your web site home directory:
    Ex.: DocumentRoot "C:/www"
    I changed my DocumentRoot so I would not have to always navigate a through a the directory tree to get to my Web documents.

    Change the *Directory ...* line to match the DocumentRoot you set above:
    *Directory "C:/www"*
    where the *'s are the 'less than' and 'greater than' symbols respectively.


To increase the size allowed to be uploaded:

You need to change 2 parameters in php.ini

; Maximum allowed size for uploaded files.
upload_max_filesize = 50M

;Maximum size of POST data that PHP will accept.
post_max_size = 50M

Then reload (it just reloads the ini files) Apache on Linux:

/etc/init.d/apache2 reload



Home > Tech Tips > Setup Apache, PHP, and MySQL