Setup PHP : Apache2

I had explained about setting up apache2 server on your own desktop here
Once you had done that the setting up php is just a step away.

Php these days have become the apt programming language for web hobbyists.It includes wnough programing varience to make your page very user interactive. Php pages cannot be run on your normal browsers.Php are a claaof server programs and can be executed only on a web server. So it nessesitates for us to either upload our "Trial.php" pageto a remote server that assists php or make our own computer a server.Resorting to the second option seems most fesible. Well just set itup once you have set up your APACHE2

Let me start with the procedure :

1)Download :

goto —->

download this binary —> PHP 5.1.4 zip package [8,919Kb] – 04 May 2006

unzip it on your computer C:\php\ and it'l have lot og DLLS.Dontget worried.There's nothing much to do with any of them.They are all intelligent fellows he he… 🙂

2) Renaming Rename C:\php\php.ini-dist it to php.ini

3)Edit your php.ini

–>Open php.ini in a text editor.find the term doc_root ( simple 'find' search can take you there) then change it to point to whatever your Apache DocumentRoot is set to. In my case: doc_root = "C:/Program Files/Apache Group/Apache2/htdocs"

NOTE: If you had followed mypost to install APACHE2 then the locations will be the same as i have suggsted.

–>extension_dir = "./" to the location of the ext directory after you unzipped my case: extension_dir = "C:\php\ext" (tht's there will be a folder called 'ext' ok!!)

–>Search for: session.save_path and uncomment (remove the ; mark) and change it to session.save_path = "c:/windows/temp"

4)Editing httpd file This is the file in your apache2–>conf folder

Add these three lines to the beggining ot the file

LoadModule php5_module "C:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"


–>Restart apache2 . If it shows no errors then you are on track.In case it shows errors then run "Test Configuration" and see which line show the error.

–>Open "Notepad" and enter this code

<?php phpinfo(); ?> and save it as try.php in the location "C:/Program Files/Apache Group/Apache2/htdocs"

–> goto your browser and test it "http://localhost/test.php

hey do you see this???

Hurray you have done it. its all set!! startwriting your PHP code. I found this site very good to learn php try it too..


P.S:- I had almost installed this thing many times and finally found out the best possible shortcut steps to end up with proper installations .In case of any glitch pls comment and otherwise also!!

Any php you wite must be in the local directory of "HTDOCS" in apache2 folder.Make a folder there and keep it in quicklaunch i do it that way!!

you may add subfolders to view your page as "http://localhost/folder1/folder2/page.php&quot;


7 thoughts on “Setup PHP : Apache2

  1. I found this while trying to set up my localhost and finally managed it. However, while I can visit and ping the adress now, the specific program I needed it for is still unable to connect to it (ARIS Business Architect). Thanks a lot for the anyways, I’m one (or more) steps closer now! 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s