Apache Installation
Double click the setup file and click next and choose I agree.
Provide Network domain and Server name as localhost and Administrator email id is your email id. Select Install Apache for all users. Click next
Select custom install and click next
You’ll notice a red X by “Build Headers and Libraries”. Click the dropdown menu by the X and select “This feature will be installed on local hard drive”.
Click on Apache HTTP Server 2.2.14 on top and make sure it’s highlighted. This is to make sure when we specify our installation location in the next step, we aren’t just specifying a component of the webserver; we want to move the WHOLE thing.
Click on change to bring up the window to change the installation path.
In the folder name text box, type in C:\webserver, and click Ok. Then click next and begin the installation.
After the installation has completed, go into a browser and type in localhost as the URL. If it the installation worked…well, Apache will tell you It works
Open the httpd.conf file with notepad. Copy and paste the following to the top of the file
LoadModule php5_module “C:/webserver/php/php5apache2_2.dll”
AddType application/x-httpd-php .php
PHPIniDir “C:/webserver/php”
Note:
This tells the webserver what files to load for php and where to locate the php configuration file.
Make sure a # does not appear until after the block of text you have pasted. ie after the above code next line should be empty and nex line should be #.
Change C:/ to drive letter in which you are installing.
Right click on My Computer and click Properties and select Advanced tab
Click Environment Variables
Under System Variables (The lower half of the screen), scroll down until you see the variable named Path. Click it and press Edit
After the last semicolon in the variable value box, copy and paste C:\webserver\php; (Include the ending semicolon)
Change C:\ to drive letter in which you are installing.
You’re done! Now it’s time for testing.
Testing PHP and Apache
Be sure to restart your apache server. You can do this by right clicking on the apache icon in the system tray and clicking Open Apache Monitor (Or you can access the apache monitor from your Programs into the start menu). Select apache 2.2 and click restart. If you do not restart your web server, PHP will not work until you restart your computer.
Open up notepad and write simple program and save the file with any name and with extension as “.php” in C:\webserver\htdocs directory.
Now open up your browser and type localhost/yourfilename.php in the address bar
If you’ve followed everything correctly, you should see the output of your program. This indicates that you can now perform server-side operations such as the execution of php scripts.
0 comments:
Post a Comment