'Out of the box' install with no modifications onto an XP SP2 machine. Firewall and any other apps/services that may hook into IP were stopped. The only change was from the default location to D:\WebServ.
No errors encountered during the install. No errors in the PHP error log. The httpd.conf and php.ini appear to have the correct entries. The path to the php folder is in the Path variable.
Symptoms of the problem;
.php files clicked on in Explorer open in Notepad.
.php files right clicked/open with Internet Explorer display the content as text. http://127.0.0.1/phptest.php works.
phptest.php contains the following;
<html>
<head>
<title>PHP test page</title>
</head>
<body >
<? phpinfo(); ?>
</body>
</html>
http://127.0.0.1/index.htm works apart from the following;
I added <? phpinfo(); ?> to the default index.htm after the <body> tag and before the first <BLOCKQUOTE>. The file displays but no phpinfo is displayed. It does not even display as text, it seems to be ignored even though it is present in a 'view source'.
I admit to knowing practically nothing about this apart from what I have found while trying to get this to work (total n00b).
If it helps, I can post any relevant files to a WEB server or by Email.
I need this to work. Can someone please offer some guidance? Thank you, Paul.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I already checked for this as I found it mentioned in a previous thread. I downloaded and installed the latest release so the 'patch' is included. Below is the PHP section from my config.
I need to look into the differences between .htm and .html as I was not aware of the relevance. The default Apache page is .htm so I made the mistake of assuming that there was no difference. Never, never, NEVER assume!
you can set up the *.htm the same way as the *.html
and yes in order for the php to be processed the call for that page needs to be requested via port 80 so that apache is called.... otherwise it is just being processed by your browser and apache is not activated to parse it...
its just a good habit to use .html for your document extensions as compared to htm...
good luck!
j.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
'Out of the box' install with no modifications onto an XP SP2 machine. Firewall and any other apps/services that may hook into IP were stopped. The only change was from the default location to D:\WebServ.
No errors encountered during the install. No errors in the PHP error log. The httpd.conf and php.ini appear to have the correct entries. The path to the php folder is in the Path variable.
Symptoms of the problem;
.php files clicked on in Explorer open in Notepad.
.php files right clicked/open with Internet Explorer display the content as text.
http://127.0.0.1/phptest.php works.
phptest.php contains the following;
<html>
<head>
<title>PHP test page</title>
</head>
<body >
<? phpinfo(); ?>
</body>
</html>
http://127.0.0.1/index.htm works apart from the following;
I added <? phpinfo(); ?> to the default index.htm after the <body> tag and before the first <BLOCKQUOTE>. The file displays but no phpinfo is displayed. It does not even display as text, it seems to be ignored even though it is present in a 'view source'.
I admit to knowing practically nothing about this apart from what I have found while trying to get this to work (total n00b).
If it helps, I can post any relevant files to a WEB server or by Email.
I need this to work. Can someone please offer some guidance? Thank you, Paul.
apache isnt parsing htm files for php content, only files with the ext php are parsed
its simple:
You need to tell Apache to parse .html files for PHP code. Apache, by default, won't do this.
Search in your apache config file for
AddHandler application/x-httpd-php .php
or
AddType application/x-httpd-php .php
These are the lines that tell Apache to parse your .php files for PHP code. Add the following "new line" to turn on parsing for .html files
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php .html #new line
or if you're using AddType for some reason
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html #newline
oh yeah, dont add the '#new line' part
I already checked for this as I found it mentioned in a previous thread. I downloaded and installed the latest release so the 'patch' is included. Below is the PHP section from my config.
#### PHP ###
#@@PHP4@@LoadModule php4_module "D:/WebServ/php/php4apache2.dll"
LoadModule php5_module "D:/WebServ/php/php5apache2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html
AddType application/x-httpd-php-source .phps
PHPIniDir "D:/WebServ/php"
The path statements are correct for this install. The files exist.
The symptoms do seem to point to this but all looks correct to my limited understanding.
I have put the php.ini and httpd.conf here if it helps
http://www.gwilliam.me.uk/config/php.ini
http://www.gwilliam.me.uk/config/httpd.conf
Thank yo for the prompt responses.
i noticed you saved your file as something.htm.... you should try it as something.html
That worked!
I need to look into the differences between .htm and .html as I was not aware of the relevance. The default Apache page is .htm so I made the mistake of assuming that there was no difference. Never, never, NEVER assume!
I also found that double clicking in Explorer does not work, it needs to be http://localhost/xxxx.html.
THANK YOU.
Now I can get on with the project I installed this for in the first place ;-)
you can set up the *.htm the same way as the *.html
and yes in order for the php to be processed the call for that page needs to be requested via port 80 so that apache is called.... otherwise it is just being processed by your browser and apache is not activated to parse it...
its just a good habit to use .html for your document extensions as compared to htm...
good luck!
j.
Kool, everyone's hapy