Starting with PHP-Apache
I am not a novice PHP programmer.rather i am also a beginner.here i am presenting some stuffs which i tried and worked.i would like to thank my friend ANILKUMAR who helped me to learn these stuffs
i think it is better to start from the basics.So shall we start from the platform ? Yes ! we should.
for running a serverside program,we need a WebServer.we all may know the typical webserver,IIS (Intrenet Information Server) incorporated with windows operating systems.but right now i am skipping it as all of us know little bit of IIS configuration and related stuffs . No ? (anyway we shall disucss it later )
i am going to talk about Apache server,a powerful product from the Apache foundation.
You can download apache server verisions from there. i have Apache 2.2.6 Server version.Run the Setup.It is quite eazy to run the wizard.the only place i suspect u may get stucked is the pane where u have to enter the Network domain,servername,Administrators email address .You can give localhost/ur local IP in the first two fields and give admin@localhost in the third field(Assume we are going to work on the same machine(same server)).
Once u finish the Installation wizard,u can verify by going to Start Menu- >Programs->Apache HTTP Server 2.2.6
Now We will Install PHP Engine.You can go to www.php.net and get the appropriate verision.i am tried with PHP 5 .Once ou download it,No need to Install anything.more over,you cant find a typical install /SetUp.exe there in the folder.no need to worry. just copy the folder which contains the unziped files and paste it in any one of your disk drives(C/D/E/F). thats All !.
Now that we’ve got PHP and Apache working separately, we need to get get them to work together.
from the Start menu option u can open the Configuration file (Start->Programs->Apache HTTP Server 2.2.6->Configure Apache server->Edit the apache httpd.config Configuration file) You can open it by any Editors like text pad/Notepad.
Now u can see the contents of the file .for a beginner ,it may be really difficult to understand what all these things .No need to bother about the contents.These are some configuration parameters which our apache server use for the execution.just go through the page.the page itself provides some general tutorials.You can find out a couple of lines starting with #LoadModule or LoadModule.just go to the end of those block of code.the # prefixed lines are commented lines
just add the following line @ the bottom of that blockof code
LoadModule php5_module “E:/php/php5apache2_2.dll”
You have to Change the Physical location to your folder
where u have the Extracted files.for me IT is the PHP Folder
in E drive.change the part before php5apache2_2.dll in the
path.(on the other habd u can make sure that this DLL exists
in that directory).
below that line add this line
AddType application/x-httpd-php .php
(This is to specify the Type of files)
Then below that line add this line
PHPIniDir “E:/php”
(Configuring the path to php.ini).You have to specify the
folder where u have those extracted php files and dlls.for
me it is E drive,PHP folder
thats all ! You have done it .Now You can save the file and
close it.Now we have to restrat the server to make these
chenges available.Go to the start menu->PRograms->Apachec
HTTP Server 2.2.6->Control Apache server->Restart
Thats all ……
write a small php program (copy this)
<html>
<body>
<form>
<?php
echo “I created my first PHP Program !”;
?>
</form>
</body>
</html>
save this as testprogram.php and put it in this folder
F:\Program Files\Apache Software Foundation\Apache2.2\htdocs
(for me It is F drive ,since i installed Apache on F Drive.for u it may be different)
then take a browser type
http://localhost/testprogram.php
press enter key.You can see your first php programs out put !
just try buddies .I will come up with some more stuff soon,(once i found those code’s are working)
Make Sure to Stop IIS in control panel->Administrative tools->services as you are running another web server(Apache)
