I'm trying to install PHP on my system separate to Apache, but don't want to go with a package like WAMP or xampp.

When I tried this previously the PHP application wasn't being executed by Apache and when viewing a PHP file in the browser, only showed the code instead of the rendered output like below:

<?php my php code ?>

How do I get Apache to know how to execute the PHP application so that when I load up PHP pages it displays the processed page and not the raw code?

link|improve this question
2  
official PHP Manual: Installation on Windows systems – Gordon Feb 26 '11 at 14:28
how is appache formed? – Tom O'Connor Feb 27 '11 at 11:08
feedback

migrated from stackoverflow.com Feb 27 '11 at 7:48

This question came from our site for professional and enthusiast programmers.

6 Answers

Somewhere in httpd.conf there must be a line like that:

AddType application/x-httpd-php .php

Also somewhere else there is a line like:

LoadModule php5_module "E:/httpd/php5/php5apache2_2.dll"

So whenever apache is requested for a .php file, it does not just transfer the file to the client. Instead it tries to handle it somehow. Now, the php5_module has registered itself as a handler for application/x-httpd-php types. So, apache forwards the request to php5_module and returns the result of the process to the client.

link|improve this answer
feedback

You need to register PHP as the handler for .php files.

See the installation chapter in the PHP manual.

link|improve this answer
feedback

The following line in the apache config file will make sure that anything with ".php" is treated as such via the AddType declaration:

AddType application/x-httpd-php .php

http://httpd.apache.org/docs/2.0/mod/mod_mime.html#addtype

link|improve this answer
feedback

Apache decides which interpreter to use with the file extension.

Default configuration normally pass files ending in .php and .php3 to your php interpreter, but you can change that in the various configuration files of Apache.

link|improve this answer
feedback

once upon time, i faced this, when i run my php application , app not executed, it simply

You need install mod_php (if you use apache).

You can download a package wich includes web-server and php. I suggest denwer - http://denwer.ru (translate it from russian via google translat), after downloading you need only install it.

And excuse me for my bad english.

link|improve this answer
nothing, enough to understand your steps, keep on update plz – Bharanikumar Feb 26 '11 at 14:58
feedback

Your Answer

 
or
required, but never shown

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