Thursday September 9, 2010 @ 21:29:52 GMT+10    ( Weather:  21°C / 70°F  -  Mostly Cloudy )
Home » Weblog Archives

Info *NOTE* This page is NOT the actual weblog entry. The purpose for this page is to provide extra background information on how this particular entry is constructed, by using custom markups and tags. To read the actual content of this entry, please go to here.

The Raw Structure:

Markup | Tag used: BBCode


[i]Last revised: 2007.01.17[/i]

I've enough headache last night trying to figure out how to make Apache 2.2.3 and PHP 5.1.4 to work together on Windows XP. After several hours of tweaking and changing the settings, I finally gave up and search for help on the web. It seems it's not my fault that they can't work in harmony. Most of the tutorial on the web is not detailed enough and the readme from Apache and PHP is gay. I'm no expert or guru on both of them, but I'll write down the steps required to get them working and hope that one day I can make somebody's life easier if they encountered the same problem as me =)

[color=red][b]Installing Apache[/b][/color]
[list=1]
[*]Go to [url=http://httpd.apache.org]Apache HTTP server project website[/url] to download the binary for windows. This guide uses Apache 2.2.3.
[*]Open the file and follow[i] the prompt. When it ask for the Network Domain[/i] and [i]Server Name[/i], use "localhost" if you're setting up a local server on your computer for development purpose, otherwise fill in the address and name according to your server. In the [i]Administrator’s Email Address[/i] field, use any email address (e.g. "admin@localhost").
[*]Continue clicking next and choose the setup type and path to install and complete the installation.
[*]If Windows (SP2) firewall prompt to ask about the program, just click "Unblock".
[*]At this point installation is completed, Apache HTTP server should be running as a service if everything is ok. Open your browser, type in http://localhost/ in the URL bar. You should see [i]"It works !"[/i] on the page.
[*]To customize the [b]httpd.conf[/b] file (located in [i]/conf[/i] in Apache folder), open with any text editor. Look for [b]DocumentRoot[/b], change the path if you want. For example:
[b]DocumentRoot "C:/Documents and Settings/user/My Documents/My Website/localhost/www"[/b]
The default path will be pointing to [i]/htdocs[/i] in your Apache folder.
[*]If you changed the [b]DocumentRoot[/b] mentioned above, remember to scroll down and look for a line that looks like
[i]# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/...">[/i]
Change the path in the [b]<Directory>[/b] tag to the same you set for [b]DocumentRoot[/b] in above. For example:
[b]<Directory "C:/Documents and Settings/user/My Documents/My Website/localhost/www">[/b]
If you don't change it, you'll get [i]Permission Denied[/i] when you browse [i]http://localhost[/i]
[*]Change any other settings to suit your server or for scricter security. The above is sufficient for normal static html hosting. See below if you need a script parser like PHP for dynamic page output.
[/list]

[color=red][b]Enable mod_rewrite for URL rewrite[/b][/color]
See [url=/weblog/101.html]Enable mod_rewrite in Windows[/url] in another entry in my weblog.

[color=red][b]Installing PHP[/b][/color]
[list=1]
[*]Go to [url=http://www.php.net]PHP website[/url] to download the binary for windows. This guide uses PHP 5.1.4.
[*]Please take note that if you followed the below steps and it's still not working with Apache, continue to read down to the section [i]Another way to make Apache and PHP work together[/i].
[*]Unzip the contents to the path you desire [i](eg. C:\php\)[/i].
[*]Go to Control Panel -> System -> Advanced tab -> Click on Environment Variables. In the System variables list, look for the variable name [b]Path[/b]. Select it and click on Edit. Append
[b];C:\php[/b]
at the back of the variable value.
[*]Now go back to the PHP folder [i](eg. C:\php\)[/i], make a copy of the file [b]php.ini-recommended[/b] and rename it to [b]php.ini[/b]. Open the[i] php.ini[/i] file with text editor. [i]*Note* This guide uses [b]php.ini-recommended[/b] file, you can use the [b]php.ini-dist [/b]if you know what you're doing.[/i]
[*]If you changed the value of [b]DocumentRoot[/b] in [b]httpd.conf[/b] file mentioned above [i](Installing Apache, Step 6)[/i], you need to change the [b]doc_root[/b] value to , for example:
[b]doc_root = C:/Documents and Settings/user/My Documents/My Website/localhost/www[/b]
[*]Save the [i]php.ini[/i]. Now open the Apache [b]httpd.conf[/b] file, look for the [b]"LoadModule"[/b] section. At the bottom of the LoadModule block, insert the following lines:
[b]# For php5 module
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
# Configure the path to php.ini
PHPIniDir "c:/php"[/b]

You can add another optional line if you know what you're doing:
[b]AddType application/x-httpd-php .php-source .phps[/b]

*Updated 2007-01-17*
If you found a DLL file named [b]php5apache2_2.dll[/b] in the PHP build you downloaded, change
[b]LoadModule php5_module "c:/php/php5apache2.dll"[/b]
to
[b]LoadModule php5_module "c:/php/php5apache2_2.dll"[/b]
[*][u][i]This step is optional[/i][/u]. Scroll down a bit and look for something like
[i]<IfModule dir_module>
DirectoryIndex index.html
</IfModule>[/i]
Made changes to the [b]DirectoryIndex[/b] and add [i]index.php[/i]. The modified one should looks like
[b]<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>[/b]
[*]Save the file and [u][b]restart[/b][/u] your computer (dont ask, just restart).
[*]Create a text file in your document root (eg. [i]C:/Documents and Settings/user/My Documents/My Website/localhost/www[/i]), insert
[b]<?php phpinfo(); ?>[/b]
into the file, save it and rename it to [i]phpinfo.php[/i].
[*]Start the Apache server as a service if it's not. Apache should be able to load the PHP module and start running. To check if everything is working, open your browser and type in [i]http://localhost/phpinfo.php[/i]. You should get a page containing information on your installation of PHP and its settings. If you don’t, try restarting Apache. [b]If [u]Apache says it can't load the php5apache2.dll or it says that the module can't be found[/u] refer to [i]Another way to make Apache and PHP work together[/i] section below[/b]
[/list]

[box]
To manipulate the Apache web server via command line, open a command prompt in Windows, navigate to the folder [i]/bin[/i] in your Apache folder and try the following commands.

[table]
{| class="weblogtable" style="margin: 1em auto 1em auto;text-align:left;"
|+ Some useful command for Apache web server
! Command !! Description
|-
| nowrap="nowrap" | httpd -k install || Install Apache as a Windows service
|-
| nowrap="nowrap" | httpd -k uninstall || Remove Apache as a Windows service. If you didn't install Apache using windows installer and you want to uinstall it, it's better you call this command before you remove the folder manually.
|-
| nowrap="nowrap" | httpd -k start || Tell Apache to start
|-
| nowrap="nowrap" | httpd -k restart || Tell Apache to do a graceful restart
|-
| nowrap="nowrap" | httpd -k stop || Tell Apache to shutdown
|}
[/table]
[/box]

[color=red][b]Installing MySQL[/b][/color]
[list=1]
[*]Go to [url=http://mysql.com/downloads/]MySQL website[/url] to download the binary for windows. This guide uses MySQL 5.0.24.
[*]Extract the zip file and run the Setup file.
[*]You should choose the Custom installation, to allow you to select an installation path. Click Next to continue and install it.
[*]When you're asked register with MySQL, Skip it if you don't have time for it. Once the installation is complete, tick the option to launch the MySQL Configuration Wizard and finish it.
[*]On the configuration wizard, select the Standard Configuration option on the first screen and click Next.
[*]On next screen, leave the 2 checkbox in default, check the 2nd one [i](include Bin Directory in Windows Path)[/i] if you want to enter MySQL commands from the command prompt without first having to navigate to the MySQL [i]\bin[/i] directory.
[*]On next screen, you can leave the password field blank for root user for you can assign a password for it. Depends on you but I strongly recommend you assign a password.
[*]Click [i]Execute[/i] on the next screen to finish the installation. Restart your computer.
[*]After rebooting, to check if MySQL is running properly or not, open a command prompt and type the following command:
[b]mysql -u root -p[/b]
You need to navigate to [i]\bin[/i] in your MySQL folder if you didn't ask MySQL to setup the Path variable during installation. If you didn't setup the password for root user, just remove the [b]-p[/b] in the above command.
If you get [i]"Can't connect to MySQL server on 'localhost'"[/i] error message, that means MySQL server is not started yet. Go to Control Panel -> Administrative Tools -> Services and look for MySQL entry. Right click and select Start. Once it's started, you can make a connection to the server using the command stated above.
[i]Alternatively, you can invoke MySQL by calling the following command:[/i]
[b]mysqld-nt --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my.ini" MySQL[/b]
[*]Once you're connected to server using the root user account, type the following command:
[b]mysql> show schemas;[/b]

You should get the following results:
[pre]+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.26 sec)[/pre]
[*]Now you need to get PHP to talk to MySQL. Open the [i]php.ini[/i] look for [b]"Paths and Directories"[/b] section and find [b]extension_dir[/b], change it to:
[b]extension_dir = "c:/php/ext"[/b]
[*]Scroll down and look for [b];extension=php_mysql.dll[/b]. You need to uncomment it by removing the ';' (semi-colon). It should looks like
[b]extension=php_mysql.dll[/b]
[*][u][i]This step is optional[/i][/u]. Uncomment the [b];extension=php_mbstring.dll[/b] if you need multibyte string functions (eg. to process unicode data)
[*]Save the file and start/restart Apache.
[*][b]*Hint*[/b] I strongly suggest that you should download the MySQL Administrator [url=http://mysql.com/downloads/administrator/]here[/url] and MySQL Query Browser [url=http://mysql.com/downloads/query-browser/]here[/url]. MySQL Administrator has powerful functions that allows you to manage/browse/backup your MySQL server/database in GUI. MySQL Query Browser is a replacement for MySQL Control Centre. It's a GUI-based program that allows you to test/execute your SQL queries. Install the MySQL Query Browser first before you install the MySQL Administrator.
Isn't life's good when you do all the things just using your mouse ? =)
[/list]

Voilà ~~~ ! There you go, everything should be working now. You shouldn't have any problem setup and run MySQL server. However, if everything goes that smooth, I wouldn't have to waste hours yesterday trying to figure out where it goes wrong. I can't get Apache to load PHP module, that's nasty and stupid problem.

Alright, [b]If [u]Apache says it can't load the php5apache2.dll or it says that the module can't be found[/u][/b] then the below steps might save you... or not...

[color=red][b]Another way to make Apache and PHP work together[/b][/color]
[list=1]
[*][u][b]*Note* This section of guide assumes that you already install PHP[/b][/u]. If not, please complete the steps in [b]Installing PHP[/b] section before continue the steps below.
[*]*Updated 2007-01-17* On newer version of PHP (I tested with 5.2.0) you should able to find a DLL file name called [b]php5apache2_2.dll[/b]. Now refering to [b]Installing PHP - Step 7[/b], change
[b]LoadModule php5_module "c:/php/php5apache2.dll"[/b]
to:
[b]LoadModule php5_module "c:/php/php5apache2_2.dll"[/b]
That should solved the problem and you can skip the steps below. If you're using older version of PHP build, please skip this step and follow the steps below.
[*]If you have Apache installed and you're stuck, uninstall it and remember to delete the folder manually for left overs (windows installer sometimes does not delete the config files, you need to clean it yourself). If you deploy Apache via a ZIP file instead of windows installer, you better do a [b]httpd -k uinstall[/b] to uninstall the service then only you delete the folder manually.
[*]Download and install Visual C++ 2005 Redistributable Package from Microsoft. It can be downloaded at the link below:
[url=http://www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en]Microsoft[/url]
[*]Download [b]httpd-2.2.3-win32-x86-ssl.zip[/b] (binary by Steffen) from [url=http://www.apachelounge.com/download/]Apache Lounge[/url] or use the direct link below:
[url]http://www.apachelounge.com/download/binaries/httpd-2.2.3-win32-x86-ssl.zip[/url]
[i]*Note* This binary is build with VC 2005, that's why you need Visual C++ 2005 Redistributable Package.[/i]
[*]The Apache binary is in ZIP file, there is no windows installer for this build. Unzip and place it to your C:\Program Files\Apache 2.2.3\
[*]Repeat the steps in [b]Installing Apache[/b] section to configure your Apache server.
[*]Download [b]php5apache2.dll-php5.1.x.zip[/b] from [url=http://www.apachelounge.com/download/]Apache Lounge[/url] or use the direct link below:
[url]http://www.apachelounge.com/download/mods/php5apache2.dll-php5.1.x.zip[/url]
[*]Unzip the file. Read the [i]Readme First.txt[/i].
[*]Copy & replace the [b]php5apache2.dll[/b] to your php folder [i](eg. c:/php)[/i]. Backup the original one if you feel to do so.
[*]Copy [b]httpd.exe.manifest[/b] to [i]/bin[/i] in your Apache folder.
[*]Open the [b]httpd.conf[/b] file from [i]/conf[/i] in your Apache folder. Look for [b]ServerRoot[/b] and change the path to where you unzip the newly downloaded Apache binary. For example:
[b]ServerRoot "C:/Program Files/Apache 2.2.3"[/b]
[*]Scroll down and look for
[i]<IfModule alias_module>
...
...
...
ScriptAlias /cgi-bin/ ...
</IfModule>[/i]
Make sure the [b]ScriptAlias[/b] is set to the correct path. For example:
[b]ScriptAlias /cgi-bin/ "c:/Program Files/Apache 2.2.3/cgi-bin/"[/b]
[*]Scroll down and look for
[i]# "c:\..." should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "c:\...">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>[/i]
Make sure the [b]<Directory>[/b] tag has the correct path. For example:
[b]<Directory "c:/Program Files/Apache 2.2.3/cgi-bin">[/b]
[*]Start your MySQL server and hit your Apache server. Your Apache should be able to load the [i]php5apache2.dll[/i] now. For extra info, see also : [url]http://www.apachelounge.com/forum/viewtopic.php?t=570[/url]
[/list]

Hope this helps. By the way, I spent another 1/2 hr trying to locate another problem after I get the LAMP up (finally). The problem is that the raw source code of the PHP script is dumped out to my browser instead of excution output from the script. The cause of this problem is because one of the required php file starts with [b]<? [/b] instead of [b]<?php [/b]... doh ! How strange, they worked in previous version of PHP5 I installed last time...

*EDIT 2006.08.30*
-- Hide the Visual C++ 2005 Redistributable Package actual link because the long url without spacing will not be wrapped by FireFox 1.5.0.6 during page rendering causing the page become "wide"

*EDIT 2006.09.19*
-- Added a how-to link to "Enable mod_rewrite in Windows"

*EDIT 2007.01.17*
-- Load php5apache2_2.dll instead of php5apache2.dll in newer version of PHP

Live Rendering:

The real-time rendered result...

Last edited: Wed 2007-01-17 @ 19:56 , by DaRen 3 time(s)

Installing Apache 2.2.3, PHP 5.1.4 and MySQL 5.0.24 on WindowsXP (SP2) - 6:05 pm
since when it's so hard to setup a simple LAMP?
Guides , PHP , Site Issue , SQL , Web Hosting  -  poster 

Last revised: 2007.01.17

I've enough headache last night trying to figure out how to make Apache 2.2.3 and PHP 5.1.4 to work together on Windows XP. After several hours of tweaking and changing the settings, I finally gave up and search for help on the web. It seems it's not my fault that they can't work in harmony. Most of the tutorial on the web is not detailed enough and the readme from Apache and PHP is gay. I'm no expert or guru on both of them, but I'll write down the steps required to get them working and hope that one day I can make somebody's life easier if they encountered the same problem as me =)

Installing Apache
  1. Go to Apache HTTP server project website to download the binary for windows. This guide uses Apache 2.2.3.
  2. Open the file and follow the prompt. When it ask for the Network Domain and Server Name, use "localhost" if you're setting up a local server on your computer for development purpose, otherwise fill in the address and name according to your server. In the Administrator’s Email Address field, use any email address (e.g. "admin@localhost").
  3. Continue clicking next and choose the setup type and path to install and complete the installation.
  4. If Windows (SP2) firewall prompt to ask about the program, just click "Unblock".
  5. At this point installation is completed, Apache HTTP server should be running as a service if everything is ok. Open your browser, type in http://localhost/ in the URL bar. You should see "It works !" on the page.
  6. To customize the httpd.conf file (located in /conf in Apache folder), open with any text editor. Look for DocumentRoot, change the path if you want. For example:
    DocumentRoot "C:/Documents and Settings/user/My Documents/My Website/localhost/www"
    The default path will be pointing to /htdocs in your Apache folder.
  7. If you changed the DocumentRoot mentioned above, remember to scroll down and look for a line that looks like
    # This should be changed to whatever you set DocumentRoot to.
    #
    <Directory "C:/...">

    Change the path in the <Directory> tag to the same you set for DocumentRoot in above. For example:
    <Directory "C:/Documents and Settings/user/My Documents/My Website/localhost/www">
    If you don't change it, you'll get Permission Denied when you browse http://localhost
  8. Change any other settings to suit your server or for scricter security. The above is sufficient for normal static html hosting. See below if you need a script parser like PHP for dynamic page output.

Enable mod_rewrite for URL rewrite
See Enable mod_rewrite in Windows in another entry in my weblog.

Installing PHP
  1. Go to PHP website to download the binary for windows. This guide uses PHP 5.1.4.
  2. Please take note that if you followed the below steps and it's still not working with Apache, continue to read down to the section Another way to make Apache and PHP work together.
  3. Unzip the contents to the path you desire (eg. C:\php\).
  4. Go to Control Panel -> System -> Advanced tab -> Click on Environment Variables. In the System variables list, look for the variable name Path. Select it and click on Edit. Append
    ;C:\php
    at the back of the variable value.
  5. Now go back to the PHP folder (eg. C:\php\), make a copy of the file php.ini-recommended and rename it to php.ini. Open the php.ini file with text editor. *Note* This guide uses php.ini-recommended file, you can use the php.ini-dist if you know what you're doing.
  6. If you changed the value of DocumentRoot in httpd.conf file mentioned above (Installing Apache, Step 6), you need to change the doc_root value to , for example:
    doc_root = C:/Documents and Settings/user/My Documents/My Website/localhost/www
  7. Save the php.ini. Now open the Apache httpd.conf file, look for the "LoadModule" section. At the bottom of the LoadModule block, insert the following lines:
    # For php5 module
    LoadModule php5_module "c:/php/php5apache2.dll"
    AddType application/x-httpd-php .php
    # Configure the path to php.ini
    PHPIniDir "c:/php"


    You can add another optional line if you know what you're doing:
    AddType application/x-httpd-php .php-source .phps

    *Updated 2007-01-17*
    If you found a DLL file named php5apache2_2.dll in the PHP build you downloaded, change
    LoadModule php5_module "c:/php/php5apache2.dll"
    to
    LoadModule php5_module "c:/php/php5apache2_2.dll"
  8. This step is optional. Scroll down a bit and look for something like
    <IfModule dir_module>
    DirectoryIndex index.html
    </IfModule>

    Made changes to the DirectoryIndex and add index.php. The modified one should looks like
    <IfModule dir_module>
    DirectoryIndex index.php index.html
    </IfModule>
  9. Save the file and restart your computer (dont ask, just restart).
  10. Create a text file in your document root (eg. C:/Documents and Settings/user/My Documents/My Website/localhost/www), insert
    <?php phpinfo(); ?>
    into the file, save it and rename it to phpinfo.php.
  11. Start the Apache server as a service if it's not. Apache should be able to load the PHP module and start running. To check if everything is working, open your browser and type in http://localhost/phpinfo.php. You should get a page containing information on your installation of PHP and its settings. If you don’t, try restarting Apache. If Apache says it can't load the php5apache2.dll or it says that the module can't be found refer to Another way to make Apache and PHP work together section below

To manipulate the Apache web server via command line, open a command prompt in Windows, navigate to the folder /bin in your Apache folder and try the following commands.

Some useful command for Apache web server
Command Description
httpd -k install Install Apache as a Windows service
httpd -k uninstall Remove Apache as a Windows service. If you didn't install Apache using windows installer and you want to uinstall it, it's better you call this command before you remove the folder manually.
httpd -k start Tell Apache to start
httpd -k restart Tell Apache to do a graceful restart
httpd -k stop Tell Apache to shutdown



Installing MySQL
  1. Go to MySQL website to download the binary for windows. This guide uses MySQL 5.0.24.
  2. Extract the zip file and run the Setup file.
  3. You should choose the Custom installation, to allow you to select an installation path. Click Next to continue and install it.
  4. When you're asked register with MySQL, Skip it if you don't have time for it. Once the installation is complete, tick the option to launch the MySQL Configuration Wizard and finish it.
  5. On the configuration wizard, select the Standard Configuration option on the first screen and click Next.
  6. On next screen, leave the 2 checkbox in default, check the 2nd one (include Bin Directory in Windows Path) if you want to enter MySQL commands from the command prompt without first having to navigate to the MySQL \bin directory.
  7. On next screen, you can leave the password field blank for root user for you can assign a password for it. Depends on you but I strongly recommend you assign a password.
  8. Click Execute on the next screen to finish the installation. Restart your computer.
  9. After rebooting, to check if MySQL is running properly or not, open a command prompt and type the following command:
    mysql -u root -p
    You need to navigate to \bin in your MySQL folder if you didn't ask MySQL to setup the Path variable during installation. If you didn't setup the password for root user, just remove the -p in the above command.
    If you get "Can't connect to MySQL server on 'localhost'" error message, that means MySQL server is not started yet. Go to Control Panel -> Administrative Tools -> Services and look for MySQL entry. Right click and select Start. Once it's started, you can make a connection to the server using the command stated above.
    Alternatively, you can invoke MySQL by calling the following command:
    mysqld-nt --defaults-file="C:\Program Files\MySQL\MySQL Server 5.0\my.ini" MySQL
  10. Once you're connected to server using the root user account, type the following command:
    mysql> show schemas;

    You should get the following results:
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | test               |
    +--------------------+
    3 rows in set (0.26 sec)
  11. Now you need to get PHP to talk to MySQL. Open the php.ini look for "Paths and Directories" section and find extension_dir, change it to:
    extension_dir = "c:/php/ext"
  12. Scroll down and look for ;extension=php_mysql.dll. You need to uncomment it by removing the ';' (semi-colon). It should looks like
    extension=php_mysql.dll
  13. This step is optional. Uncomment the ;extension=php_mbstring.dll if you need multibyte string functions (eg. to process unicode data)
  14. Save the file and start/restart Apache.
  15. *Hint* I strongly suggest that you should download the MySQL Administrator here and MySQL Query Browser here. MySQL Administrator has powerful functions that allows you to manage/browse/backup your MySQL server/database in GUI. MySQL Query Browser is a replacement for MySQL Control Centre. It's a GUI-based program that allows you to test/execute your SQL queries. Install the MySQL Query Browser first before you install the MySQL Administrator.
    Isn't life's good when you do all the things just using your mouse ? =)

Voilà ~~~ ! There you go, everything should be working now. You shouldn't have any problem setup and run MySQL server. However, if everything goes that smooth, I wouldn't have to waste hours yesterday trying to figure out where it goes wrong. I can't get Apache to load PHP module, that's nasty and stupid problem.

Alright, If Apache says it can't load the php5apache2.dll or it says that the module can't be found then the below steps might save you... or not...

Another way to make Apache and PHP work together
  1. *Note* This section of guide assumes that you already install PHP. If not, please complete the steps in Installing PHP section before continue the steps below.
  2. *Updated 2007-01-17* On newer version of PHP (I tested with 5.2.0) you should able to find a DLL file name called php5apache2_2.dll. Now refering to Installing PHP - Step 7, change
    LoadModule php5_module "c:/php/php5apache2.dll"
    to:
    LoadModule php5_module "c:/php/php5apache2_2.dll"
    That should solved the problem and you can skip the steps below. If you're using older version of PHP build, please skip this step and follow the steps below.
  3. If you have Apache installed and you're stuck, uninstall it and remember to delete the folder manually for left overs (windows installer sometimes does not delete the config files, you need to clean it yourself). If you deploy Apache via a ZIP file instead of windows installer, you better do a httpd -k uinstall to uninstall the service then only you delete the folder manually.
  4. Download and install Visual C++ 2005 Redistributable Package from Microsoft. It can be downloaded at the link below:
    Microsoft
  5. Download httpd-2.2.3-win32-x86-ssl.zip (binary by Steffen) from Apache Lounge or use the direct link below:
    http://www.apachelounge.com/download/binaries/httpd-2.2.3-win32-x86-ssl.zip
    *Note* This binary is build with VC 2005, that's why you need Visual C++ 2005 Redistributable Package.
  6. The Apache binary is in ZIP file, there is no windows installer for this build. Unzip and place it to your C:\Program Files\Apache 2.2.3\
  7. Repeat the steps in Installing Apache section to configure your Apache server.
  8. Download php5apache2.dll-php5.1.x.zip from Apache Lounge or use the direct link below:
    http://www.apachelounge.com/download/mods/php5apache2.dll-php5.1.x.zip
  9. Unzip the file. Read the Readme First.txt.
  10. Copy & replace the php5apache2.dll to your php folder (eg. c:/php). Backup the original one if you feel to do so.
  11. Copy httpd.exe.manifest to /bin in your Apache folder.
  12. Open the httpd.conf file from /conf in your Apache folder. Look for ServerRoot and change the path to where you unzip the newly downloaded Apache binary. For example:
    ServerRoot "C:/Program Files/Apache 2.2.3"
  13. Scroll down and look for
    <IfModule alias_module>
    ...
    ...
    ...
    ScriptAlias /cgi-bin/ ...
    </IfModule>

    Make sure the ScriptAlias is set to the correct path. For example:
    ScriptAlias /cgi-bin/ "c:/Program Files/Apache 2.2.3/cgi-bin/"
  14. Scroll down and look for
    # "c:\..." should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have that configured.
    #
    <Directory "c:\...">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
    </Directory>

    Make sure the <Directory> tag has the correct path. For example:
    <Directory "c:/Program Files/Apache 2.2.3/cgi-bin">
  15. Start your MySQL server and hit your Apache server. Your Apache should be able to load the php5apache2.dll now. For extra info, see also : http://www.apachelounge.com/forum/viewtopic.php?t=570

Hope this helps. By the way, I spent another 1/2 hr trying to locate another problem after I get the LAMP up (finally). The problem is that the raw source code of the PHP script is dumped out to my browser instead of excution output from the script. The cause of this problem is because one of the required php file starts with <? instead of <?php ... doh ! How strange, they worked in previous version of PHP5 I installed last time...

*EDIT 2006.08.30*
-- Hide the Visual C++ 2005 Redistributable Package actual link because the long url without spacing will not be wrapped by FireFox 1.5.0.6 during page rendering causing the page become "wide"

*EDIT 2006.09.19*
-- Added a how-to link to "Enable mod_rewrite in Windows"

*EDIT 2007.01.17*
-- Load php5apache2_2.dll instead of php5apache2.dll in newer version of PHP
$ view_blog.php 2009.09.17 18:16:41 $
Lost? | XML/HTML sitemap | Contact
38.107.191.87 , 23 queries , 0.0847s
Gzip enabled , CSS compressed , JS compressed
Copyright © 2005-2009 Darren's Outpost