Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Web Server Configuration _ Can't get PHP to work with Apache 2.2

Posted by: Technetium Mar 17 2011, 12:39 PM

I just installed Apache 2.2 on my laptop which is running Windows Vista. I'm setting this up so that I can work on PHP on my computer without having to put them on the internet for testing. The server works okay in that putting http://localhost correctly goes to the folder I specified in the configuration file, and loads up the index.html found there.

I want to set up PHP, and I downloaded the zip file for VC6 x86 Thread Safe found on php.net. My understanding is that this is the correct file for Apache 2.2. I then did the following:
1. copied contents of zip file to c:\php
2. Opened httpd.conf again from the Apache conf folder
3. added 'LoadModule php5_module "c:/php/php5apache2_2.dll" ' after the existing LoadModule lines
4. added 'AddType application/x-httpd-php .php' after the existing AddType lines
5. added 'PHPIniDir "c:/php" ' to the end of the file
6. I changed the DirectoryIndex line so that it now reads "DirectoryIndex index.php index.html".
7. I created a file called "test.php" that contained only the line "<?php phpinfo(); ?>" and put it in the root folder for my Apache server.
8.I restarted Apache and put "http://localhost/test.php" into the URL.

However, it just showed me the code when it loaded. I also tried running "c:\php\php-cgi test.php" from the command prompt and it returned:
Status: 404 Not Found
X-Powered-By: PHP/5.2.17
Content-type: text\html

There must be something I've missed doing. I copied the instructions I found online for doing this, though. I've double and triple checked for typos in the lines I added to httpd.conf. Any ideas?

Posted by: jimlongo Mar 18 2011, 10:11 AM

It's far easier to just install http://www.wampserver.com/en/ (Windows version of Apache/msyql/php).

There's also http://www.mamp.info and http://www.lamphowto.com/ extremely easy to install and configure.

I installed MAMP in seconds and it runs flawlessly without any hoops to jump through.


Posted by: Technetium Mar 18 2011, 12:54 PM

I should have updated the post to say that it works now. I'm not sure what happened, but it works now.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)