Sunday, November 18, 2007

Setting up Apache 2 and PHP 5 on Vista Home Basic

So painful as it can be...it took me 5 hours of tolls get these two basic web development environment on my Windows Vista Home Basic. It is so ridiculously painful that I even decided to open this personal tech note blog. I remember I have been pained by similar installation drills for at least 3 times, I don't want this dumb shit to happen to me again. Let's make this for the same cause as the existence of history---the hope to avoid repeating the same mistakes.


Damn, it is 4:25 am already.

Cratle Notes:

Preparations

Downloads
Software : Version : Platform : File
PHP5 : 5.2.5 : Win32 : File
Apache 2.x : 5.2.5 : Win32 : File

To-Do
Turn off the Windows Firewall
Turn off User-Control from Control Panel -> User Settings


Steps:
Install Apache first
Then Install PHP 5



Installing PHP 5:
Do not intall all those extensions, leave it as default.
Only the PHP - Program - CLI Executable is useful
Otherwise there will be many errors due to files not found when executing php -v in cmd

After installing php5:
Open (Apache Path)\conf\httpd.conf

PHP msi added the following lines at the bottom of the file:

#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
ScriptAlias /php/ "C:/PHP/"
Action application/x-httpd-php "C:/PHP/php-cgi.exe"
PHPIniDir "C:/PHP/"
LoadModule php5_module "C:/PHP/php5apache2_2.dll"
PHPIniDir "C:/PHP/"
LoadModule php5_module "C:/PHP/php5apache2.dll"
PHPIniDir "C:/PHP/"
LoadModule php5_module "C:/PHP/php5apache.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

Change it to

#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
ScriptAlias /php/ "C:/PHP/"
Action application/x-httpd-php "C:/PHP/php-cgi.exe"
PHPIniDir "C:/PHP/"
#LoadModule php5_module "C:/PHP/php5apache2_2.dll"
#PHPIniDir "C:/PHP/"
LoadModule php5_module "C:/PHP/php5apache2.dll"
#PHPIniDir "C:/PHP/"
#LoadModule php5_module "C:/PHP/php5apache.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

Working

Notable References

http://senese.wordpress.com/2007/06/06/install-php-5-under-apache-22-and-windows-vista/
http://www.expertsrt.com/tutorials/Matt/install-apache.html

4:34 AM 11/18/2007

4 comments:

Anonymous said...

You can try XAMPP or WITSuite (installation video: http://www.witsuite.com/products/installer/).

jo_cstd said...

You setup PHP to run both as CGI and as a module. You cannot do that.

Anonymous said...

Thanks !!!

Anonymous said...

Thanks man!!! excelent!!!
'Saludos desde México'