Softpedia
 

NEWS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
Home > News > Webmaster > Tips and Tricks

August 16th, 2007, 15:32 GMT · By Adrian Placinta

Manually Configure PHP5 and Apache2

SHARE:

Adjust text size:



Enlarge picture
The easiest way to install PHP and Apache is to use software bundles like XAMPP, WAMP, Apache2Triad and many others. But many web developers prefer to install
everything manually.

So, the first step is to download the latest versions of the packages, for security reasons: PHP 5.2.3 and
Apache 2.2.4.

Installing Apache is easier if you download .msi package. Run the installation wizard and in the Server information window insert localhost at Network Domain and Server Name. In the same window, choose if you want to install Apache as a Service or if you want to start it manually. In the next windows choose typical installation, then choose the folder where you want to install Apache and so the installation is completed. By default, Apache's document root is set to htdocs directory. htdocs is located in C:/Program Files/Apache Software Foundation/Apache2.2/htdocs.

To install PHP, first you have to extract the PHP package to c:php. Rename php.ini-dist to php.ini and copy the file to windows folder: C:/Windows. PHP stores in php.ini all the configurations and if you want to install, for example, an extension, you will need to modify this file. Edit php.ini in WordPad and go to the 'Paths and Directories' section. Replace doc_root= withdoc_root = "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"

Now you have to configure Apache to work with PHP. Open httpd.conf file from "C:/Program Files/Apache Software Foundation/Apache2.2/conf". There you have to add:

CODE
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php

and also configure the path to php.ini and add this line:
CODE
PHPIniDir "C:/php/"

Save and close the file and restart Apache. To test the installation, paste the following code
CODE

to wordpad, rename it to phpinfo.php and copy it to htdocs folder. In your browser type: http://localhost/phpinfo.php and you should have a screen with Server related information and variables.

TELL US WHAT YOU THINK:

40,737 hits · 18 comments · Link to this article · Print article · Send to friend · Subscribe to news

MUST-READ RELATED ARTICLES:


Monitoring a Linux System with X11/Console/Web-Based Tools

Installing NTFS Write Support on Fedora/Ubuntu

Microsoft Finally A Winner, Beats The Vulnerable Apache

PHP 4 to Reach Its End-of-Life This Year

KDE 4.0 Beta 1 Available Now

READER COMMENTS:


Comment #1 by: Boony on 22 Aug 2007, 03:31 UTC reply to this comment

Thanks for that, I had been using Apache 2.0.59 due to 2.2 problems with PHP.

Just upgraded now I'm on PHP 5.2.3 and works great, I don't even have to move dlls around now when I upgrade PHP.

Just one thing I would like to add to your notes, that is, to remind people to add index.php to the directory index line in the config file to be :-
DirectoryIndex index.html index.php

Thanks again,
Boony


Comment #2 by: jaspal on 31 Aug 2008, 07:28 UTC reply to this comment

thanks for the info.....i m really glad...to see that help.....

and its working fine with me. Take care. God Bless ya


Comment #3 by: PRASHANT on 06 Oct 2008, 19:01 UTC reply to this comment

After configuring PHP5 and Apache 2.2 as per the settings above on localhost i m getting following error on IE

This error (HTTP 403 Forbidden) means that Internet Explorer was able to connect to the website, but it does not have permission to view the webpage.

Pl help.


Comment #4 by: morne on 11 Oct 2008, 12:56 UTC reply to this comment

Hi i have done the above but i still have this error can u please help


The website cannot display the page
HTTP 500
Most likely causes:
The website is under maintenance.
The website has a programming error.

What you can try:
Retype the address.

Go back to the previous page.

More information

This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.

For more information about HTTP errors, see Help.


Comment #5 by: Taty on 21 Nov 2008, 19:18 UTC reply to this comment

I am getting this error message while restarting apache. Any guidance?

Could not reliably determine the server's fully qualified domain name using 192.168.0.10 for ServerName


Comment #6 by: Taty on 21 Nov 2008, 23:25 UTC reply to this comment

I am getting the below error message. Any guidance? Thanks

Could not reliably determine the server's fully qualified domain name using 192.168.0.10 for ServerName


Comment #7 by: Signupandmakemoney on 05 Jun 2009, 22:59 UTC reply to this comment

I followed your instructions to the "T" and it worked perfectly. Thanks for writing the post. I finally have apache and php working properly on my computer.


Comment #8 by: Arun on 06 Jul 2009, 19:02 UTC reply to this comment

It helped me a lot. Thanks.


Comment #9 by: Sagar on 23 Aug 2009, 14:51 UTC reply to this comment

Hi
Thanks, it resolves 403 error and its working now.


Comment #10 by: thilak on 03 Oct 2009, 13:57 UTC reply to this comment

I followed instructions above but still I'm not getting in. do i have to copy php.ini to windows which i modified one? pls help me to getting into php.


Comment #11 by: BhupenderSingh on 14 Feb 2010, 14:49 UTC reply to this comment

thnks a lot......it worked immediately after i made changes as instructed in your document...
again thnks.......


Comment #12 by: kuv on 20 May 2010, 14:12 UTC reply to this comment

here is my error
httpd.exe: Syntax error on line 64 of C:/
n/Apache2.2/conf/httpd.conf: Cannot load
he specified module could not be found.

help meplease


Comment #13 by: Dion on 13 Jul 2010, 09:18 UTC reply to this comment

Works 100%.

Thanks a mil.


Comment #14 by: hima on 09 Sep 2010, 17:39 UTC reply to this comment

after installerion , hw can we add the code :LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php


Comment #15 by: hima on 09 Sep 2010, 17:41 UTC reply to this comment

cant see any httpconf filee....y?


Comment #16 by: Komz on 26 Aug 2011, 02:14 UTC reply to this comment

Where do i add the following?
PHPIniDir "C:/php/"


Comment #17 by: Anon on 06 Jan 2012, 20:59 UTC reply to this comment

Great Article. Works perfect, thanks.


Comment #18 by: nish on 08 Mar 2012, 11:44 UTC reply to this comment

cannot load 'c:/php/php5apache2_2.dll' please help me

Copyright © 2001-2012 Softpedia. Contact/Tip us at

WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM