Apache Configuration

I have gone over and over tryingto find the error Apache gives when I try to run it after I installed PHP. The error says "Cannot load C:/Program Files/Apache Software Foundation/Apache2.2/C/PHP/php5apache2_2_17.dll into server: The specified module could not be found.
I have put in php5apache2_2.dll and put it with this last error. No matter what I put in it is wrong. I am just learning and I think this may be way over my head. Will anyone help me? My php is php5.2.17-Win32 VC6x86

Are you trying to set up Apache + PHP on a local Windows machine?

I would recommend grabbing WAMP server.

One easy package to install and you get Apache + PHP + MySQL all working together nicely. The extra bonus is that WAMP server lets you easily swap versions of PHP - very handy when you need to test something on a very specific version…


I am wondering if someone could help me in configuring Apache to work with PHP. I am using the book “Build Your Own Database Driven Website Using PHP & MYSQL”.
I’ve decided to go for the manual install option and I need to access the file “httpd.conf” in notepad to make a few changes plus add the following code at the end of the file before restarting Apache:

LoadModule php5_module “C:/PHP/php5apache2_2.dll
AddType application/x-httpd-php .php
PHPIniDir “C:/PHP”.

I receive an error message stating that the requested operation has failed when I restart Apache. I’ve realised that this is because the highlighted file does not exist in my PHP directory. I download my PHP files from http://windows.php.net/download/ as specified in the book (current version 5.4.3).

Could anybody please help me out with as of why the file doesn’t exist or perhaps a different file should be linked to instead?



I began with an early version of Kevin Yank’s book and thought the directions (for Windows) were a bit out of order. I created a checklist and, with that, installation went fine. Upon updating to Win7, though, problems arose because the default directories in the install process went to Program Files, a directory protected by Windows. You can beat that problem by using another directory (I use another drive partition for all my web work) for both Apache and PHP - just know what directories you use and specify them in the code above. It’s okay to install MySQL 5 into Program Files as it operates as a service.

From here, I’d recommend UNinstalling Apache so you can actually work with the httpd.conf (and httpd-vhosts.conf) files without it being a total PITA! Yes, you’ll still need to edit the C:\Windows\System32\drivers\etc\hosts file AS THE ADMINISTRATOR if you want to create a virtual host on your test server (highly advised!) but that’s only a minor inconvenience.

When installing Apache, be sure that IIS and Skype are not using port 80 (STOP their services and reset their properties to NOT start when Windows loads) and identify your server as localhost at After that, PHP can easily modify the httpd.conf to “register it” and you’ll be set.

BTW, you may also want to change the default location of your localhost’s websites as I found it inconvenient to use the htdocs folder for a large number of websites which I setup as VirtualHosts.




How do i go about creating a partition of my drive? Although I do have a 1TB hard drive which I have plenty of space to make use off.
When you say that PHP can modify the httpd.conf file, would this save me having to go into the .dll file myself.

It is possibly a Win 7 issue as I have previously installed a virtual server but I cant remember if i was on XP at the time.


Here is the real easy way – uninstall Apache, get yourself the Web Platform Installer, setup IIS and PHP5 under the platforms section and you’ll be good to go. No need to learn how to hand plumb apache on windows in 2012.

Hi Carltild,

You can Dynamically resize your ITB drive partition that will leave you with unallocated space. You then format this to NTFS using Windows 7 built-in ‘Administrative Tools’ and pick a meaningful drive label

Here is a YouTube video that walks you through the process https://www.youtube.com/watch?v=utUvkgKAtKU


As much as I respect wwb_99, I’m fully aware that his avatar used to be MS with a big dollar sign and the words MS Shill. Wyatt is extremely knowledgeable about WinDoze systems but I wouldn’t use anything M$ on a production (and, therefore, test either) server.

Much as SS said, open WinDoze Explorer, right click on My Computer and select Manage (as administrator). Then click the Manage Drives. From there, you can resize, rename, etc to your heart’s content. HOWEVER, I’ve just been through my second bout with WinDoze about moving the OS to a SSD and it’s a PITA so, if you have problems, the AOMEI Partition Assistant Pro does an excellent job - much like the old PowerQuest Partition Magic which was bought then killed by Symantec ;(

Personally, I created a W: drive, named it “Web”, and have my Apache and PHP sitting on it along with all my virtual host directories. Of course, you’ll still need to edit the hosts file (C:\Windows\System32\drivers\etc\hosts - extensionless file) as Administrator but that’s all the PITA you have to deal with Win7 about.



Thanks for the kind words. If you don’t trust windows why are you running it at all?

You also might want to encourage this guy to backup before he does potentially destructive operations to his hard drive. Re-partitions are not guaranteed to be successful even in 2012.