Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I already have an Apache server (2.2.22) up and running on my local machine, and have been using it to serve back static content. I am now trying to install PHP (5.2+) so I can get Apache serving back dynamic content, and am running into a snag.

I went directly to PHP's site and tried to download the Windows binary for 5.4.0. The installation instructions were confusing and wanted me to grab a WIX tool for some reason so I could then simulate an MSI installer (at the least thats what I gathered). So after about an hour of frustration, I abandoned that approach an instead went to SourceForge where I found this nifty MSI, which I know isnt a recommended/endorsed practice by the people at PHP for security/performance reasons, but I'm not running a Top 100 e-commerce site here...I'm just trying to get PHP up and running on my local machine for development purposes.

When I ran that MSI, one of the first windows asks me which server I want to install PHP for. It listed the following options:

  • IIS/FastCGI
  • Other CGI
  • Do not install a web server

I choose "Other CGI", under the premise that it was the correct choice for a WAMP stack setup (which is what I am aiming to achieve). After that, I just chose all the defaults/recommended settings and finished the installation. I now see PHP "installed" under C:\Program Files\PHP\.

I expected that - after choosing "Other CGI" - it would have asked me to configure the PHP installation with my Apache instance (installed under C:\Program Files\Apache Software Foundation\Apache2.2\). But this was not the case, so my first question is:

  • Was I wrong to choose "Other CGI", and if so, how do I correct that mistake?

Assuming I was correct to do this, then the only conclusion I can draw is that I must now manually go into PHP and configure/point it to work nicely with my Apache server. So my second question is:

  • If I do need to manually configure PHP, what is my next step here (can someone point me to the correct documentation, etc.)? And, if no manual configuration is necessary, then how do I get Apache serving back PHP pages?!?

To test Apache/PHP, I made the following htdocs/test.php file:

<? phpinfo(); ?>

When I go to localhost/test.php it just gives me that same exact line of text (above), instead of displaying the normal/proper PHP Info page, which (obviously) indicates PHP is not working with Apache yet. Thanks in advance for any nudges in the right direction or helpful pointers!

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

I have always found that downloading and installing each thing on its own, it can be a bit of a pain. I have switched to using xampp Which provides me with everything you need to have a WAMP server (windows, apache, mysql, and php). XAMPP also provides you with filezilla and a mail server(though I have not been able to make the mail server work for myself). Not only do they support windows with their installer but they also do Linux and mac.

share|improve this answer
    
That is an excellent, excellent suggestion @bretterer and I will absolutely look into it. It's also nice to see I'm not the only developer out there thats having problem getting a WAMP up and running. Quick question: my current Apache configuration must absolutely stay "as is" at all costs - can I use XAMPP to install a 2nd Apache instance that won't interfere with the 1st one?!? –  pnongrata Apr 6 '12 at 13:57
    
I ask because the current Apache server is actually being used on other projects and I don't want to break them by overwriting anything during the XAMPP install. –  pnongrata Apr 6 '12 at 13:57
    
@AdamTannon I have to be completely honest about this one. I have not had to keep my configuration when switching to using XAMPP. I am not sure if you can install a second apache instance however I would think you could as long as you use a different port for the instance as well as a different location for your document root and installation. –  bretterer Apr 6 '12 at 14:11
    
@AdamTannon have you had much luck yet? –  bretterer Apr 9 '12 at 20:33
add comment

This is way outdated, but I figured I'd give the answer to the question.

First question: "Other CGI" is the correct selection in this case,

Second Question: Put the following into your /Apache2.2/config/httpd.config file

 LoadModule php5_module "c:/program files/php/php5apache2.dll"
 AddHandler application/x-httpd-php .php
 PHPIniDir "c:/program files/php"

Also, check here for a great tutorial on setup (albeit a little outdated)

EDIT: Just an FYI, make sure your paths are correct e.g. c:/program files/php/ is isolated to the case above. Also, be aware of the Apache version you're using, as php5apache2.dll may very well be php5apache2_2.dll in the case above. The name of the file depends on your install version.

Source

share|improve this answer
1  
Welcome to SuperUser! Good answer, we are always happy to take material, no matter how long it has been since the question has been asked. No need to worry about thread necro and such here. –  David Nov 25 '13 at 21:51
    
@David, thanks for the warm welcome. I just felt the need to answer as the answer chosen wasn't actually a solution to the question, more of a work around. I updated the answer a little just for more clarification for those that may require it. –  darcher Nov 28 '13 at 17:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.