The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Can't get PHP to work with Apache 2.2
Technetium
post Mar 17 2011, 12:39 PM
Post #1


Newbie
*

Group: Members
Posts: 12
Joined: 16-March 11
Member No.: 14,144



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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
jimlongo
post Mar 18 2011, 10:11 AM
Post #2


This is My Life
*******

Group: Members
Posts: 1,094
Joined: 24-August 06
From: t-dot
Member No.: 16



It's far easier to just install WAMP (Windows version of Apache/msyql/php).

There's also MAMP and LAMP extremely easy to install and configure.

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



--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Technetium
post Mar 18 2011, 12:54 PM
Post #3


Newbie
*

Group: Members
Posts: 12
Joined: 16-March 11
Member No.: 14,144



I should have updated the post to say that it works now. I'm not sure what happened, but it works now.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 1st August 2014 - 12:45 AM