-
Jun 2nd, 2011, 02:44 AM
#1
Installing PHP 5.3 and Apache HTTP Server on Windows 7
If you just want to install Apache and aren't bothered about PHP, read Installing Apache HTTP Server on Windows 7.
Installing PHP
At the time of writing, the latest stable version is 5.3.6.
- Download PHP from this page:
http://windows.php.net/download/
Get the latest thread-safe VC9 binary in zip archive format.
- Extract the archive into a suitable directory — usually C:\php\.
- Navigate into this directory and rename the file php.ini-development to php.ini.
This will give you a configuration which is suitable for development work. (For example, all error messages and warnings will be shown.)
- Open a terminal window. Change into the directory where you extracted the files and run php -i. You should see rather a lot of output.

Installing Apache HTTP Server
At the time of writing, the latest stable version is 2.2.19.
- Download Apache from this page:
http://www.apachelounge.com/download/
Get the first link under the heading "Apache 2.2 win32 binary". It's another zip archive.
- Extract the archive. The default path is C:\apache2\.
(If you want to extract it elsewhere, look for that path in the httpd.conf file and change it to the path which you used.)
- Using your terminal window, change into the bin directory under the Apache directory, and run httpd -k install to install Apache as a service.

Ignore the message about the domain name, if it appears.
- Run httpd -k start to start the server.

Now navigate to http://localhost/ to see if it worked.

The file you are seeing is index.html, under htdocs in the Apache directory.
Configuring PHP as an Apache Module
- Edit the file conf\httpd.conf under the Apache directory.
Add the following to the bottom of the file:
Code:
LoadModule php5_module "c:/php/php5apache2_2.dll"
<IfModule php5_module>
AddType application/x-httpd-php .php
PHPIniDir c:/php/
DirectoryIndex index.php index.html
</IfModule>
If you installed PHP into a different path, change the paths above.
- In the htdocs directory, create a file called test.php with the following contents:
Code:
<?php phpinfo(); ?>
- Restart Apache (httpd -k restart) to effect the changes we've made.
- Now navigate to http://localhost/test.php in your web browser.
You should see a page like this:

Great success!
Installing MySQL Server 5.5 on Windows 7
Last edited by penagate; Jun 2nd, 2011 at 04:36 AM.
-
Aug 18th, 2012, 03:25 PM
#2
Member
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
great job..
-
Oct 21st, 2012, 05:13 PM
#3
New Member
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
need help installing Apache
The php install was successful however when running the httpd -k install , an error occurs saying
<OS 5>Access is denied. : FAiled to open the WinNT service manager
Please help regarding the same
Regards,
AsG
-
Oct 22nd, 2012, 12:01 AM
#4
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
Make sure the terminal you use to run the command has administrative privileges. (When logged in as a user with admin rights, find 'Command Prompt' in the Start menu, right-click on it, and choose 'Run as administrator'.)
-
Feb 8th, 2013, 02:43 PM
#5
New Member
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
Thank you very much. It was the only well illustrated guide on Internet. I had serious trouble in installing both Apache and PHP.
One important point that mentioning it will be useful is that if you 've downloaded PHP version 5.4 (all its sub-versions), in the stage of modifying config file (httpd.conf), instead of writing this line:
LoadModule php5_module "c:/php/php5apache2_2.dll"
you should wirte this one:
LoadModule php5_module "c:/php/php5apache2_4.dll"
The change is in the name of file, Although the old DLL file still exists in the directory, it isn't functional and if you use if, you will get an error concerning the lack of existence of the file.
Another point is that if you 're going to log in with the administrator user account for the first time (to prevent having problem with privileges), remember to start Apache windows service in services console. It is not started by default, even if its status is auto. You should start it manually for the first time.
Cheers.
-
Feb 9th, 2013, 03:17 AM
#6
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
Good tips. I'll update the guide soon.
-
Aug 16th, 2013, 01:19 PM
#7
New Member
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
Nice, detailed description but I have a couple of suggestions:
- Installing binaries on the root directory may be normal in Linux but in Windows 7 is not good practice. These should be installed in c:/Program Files. However, to do this in Windows 7 you should first do everything suggested above, including editing the config files (httpd.conf and php.ini), in temporary folders, say c:/Users/[name]/Documents/Apache and (ditto root)/PHP and then copy these two folders to Program Files. Windows 7 is very protective of files and folders under Program Files and it is a royal pain trying to edit files once they are copied to Program Files. NB You will of course have to change some directives within these config files.
- There are two changes I'd make to Apache's httpd.conf. First, change the Document Root to something like C:/Users/[your name]/Documents/Websites. In other words, store your web documents...where else but under Documents? Again, this is normal Windows practice but it also makes the files easier to access and to backup.
- If you are just using the webserver to test PHP scripts locally before sending them off to your host, I suggest setting the "listen" directive to localhost:80, so that you don't inadvertently start up a webserver that listens to the world outside. Unlikely because most people are behind firewalls these days but just an additional precaution.
Yes, I agree that all the advice out there keeps telling people to install on the root and put documents in c:/Apache/docs but that's because most advice seems to come from Linux users. I've been doing it this way for 10 years and have never had a problem with this set up.
-
Sep 15th, 2013, 10:04 AM
#8
New Member
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
I have followed the steps to install PHP but when I write "php i" on command prompt it gives error " The program can't start because MSVCR110.dll is missing from your computer. Try reinstalling the program to fix this problem"
-
Sep 15th, 2013, 10:24 AM
#9
New Member
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
 Originally Posted by smnaqi
I have followed the steps to install PHP but when I write "php i" on command prompt it gives error " The program can't start because MSVCR110.dll is missing from your computer. Try reinstalling the program to fix this problem"
This thread is 2 years old. The new installs for the most recent Apache version require VC10 (not the VC9 mentioned above). Download them from here: http://www.microsoft.com/en-us/downl....aspx?id=30679
-
Sep 16th, 2013, 08:04 AM
#10
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
I haven't used PHP on Windows for a long time (since this thread was written, in fact) but I believe PHP 5.5 is built against VC11 — for which, in addition to the runtime linked above, you will probably need a VC11 Apache binary, which you can get here:
www.apachelounge.com/download/
-
Sep 16th, 2013, 11:13 AM
#11
New Member
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
Ah yes, I stand corrected on the VC for the latest versions--and I should know as I have installed them myself recently. Fortunately, the link is the correct one and will download VC11...although you too may also be confused by the fact that 2012 installs VC11
-
Apr 29th, 2014, 05:55 AM
#12
Registered User
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
Very-2 use full link - Thanks
-
Sep 21st, 2014, 02:25 PM
#13
Registered User
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
Hi! thank you very much for this very good illustrated guide.After install PHP and Apache HTTP Server,i fail to start the server by run httpd -k start in the terminal window.i have this error:
httpd: Syntax error on line 37 of C:/Program Files/WebDev/Apache/Apache24/conf/hHpd.conf: ServerRoot must be a valid directory.
please help
regards
Baba
-
Sep 25th, 2014, 06:13 AM
#14
Registered User
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
hi i saw my error and after that i run httpd -k start in the terminal window and gave autorisation to Windows fire fall.after that i navigated to http://localhost/ but i have this message: This webpage is not available
please help
regards
Baba
-
Sep 26th, 2014, 02:45 PM
#15
Registered User
Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7
here is the message in the terminal window:
c:\Apache24\bin>httpd -k start
AH00558: httpd: Could not reliably determine the server's fully qualified domain
name, using fe80::213a:9216:28da:fc12. Set the 'ServerName' directive globally
to suppress this message
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|