In this guide, you will know how to Install PHP 5 to work with Apache 2.2 on Windows. So you will need to download and install Apache. To install and configure Apache see this Guide.
Now Download PHP 5 from here. Now install PHP5. Follow the Image Tutorial :



Now PHP is installed on your system. You need to make some changes to PHP's configuration file so that it can work without any problems. Go to C:\Program Files\PHP and open php.ini. It will open in notepad, now search for the following code :
Code:
short_open_tag = Off
Now replace the code with this one :
Code:
short_open_tag = On
Sometimes, older PHP scripts may be ran on the server, which you might sometimes don't know or may be you are running some third party php scripts. But all those scripts will not run unless you make some other change. Now find the following code from php.ini file :
Code:
register_globals = Off
And replace the code with the code below :
Code:
register_globals = On
Note : Don't change this if you are not sure.
You will not want your users to see if any error occurs on your site, so you need to disable error showing. In php.ini file search for :
Code:
display_errors = On
And change the value to Off so it becomes :
Code:
display_errors = Off
If your website uses sessions, then you need to change the following code :
Code:
;session.save_path = "/tmp"
you will need to change this path as there is no "/tmp" folder. You can change this to :
Code:
;session.save_path = "C:\tmp"
Save the file and proceed.
Configure Apache to run PHP scripts.
Open Apache's folder and go to conf folder. From there opne httpd.conf file and it will open with notepad. Now add this line to the file :
Code:
LoadModule php5_module "c:/php/php5apache2_2.dll"
Now php scripts requires to run an application which could convert the php scripts which is understandable by Apache. For doing this you need to add this line too :
Code:
AddType application/x-httpd-php .php
Now save
the file and restart Apache.
Thats it, Done!
Bookmarks