Jump to content


This topic is now archived and is closed to further replies.


PHP SSI in .html problem

Recommended Posts

I am migrating to a new server and none of my old PHP SSI do work anymore.

Old config: Plesk 7.5.4 with PHP 4.3.8 running Apache 2.0.50 on Fedora
New Config: Plesk 7.5.4 with PHP 4.3.11 running Apache 2.0.53 on Fedora

The code in question is on an HTML page:
<!--#include virtual="includes/header.php" --> [/code]
Works perfectly on old server, all the header/footer and right sections of the site are all PHP SSI, but on the new server the page will not even display. Gives a "The page cannot be displayed" error.

I have tried to replace them with SHTML on the new server and it works fine, so SSI is turned on properly. All my PHP pages of the site do work properly and all the PHP SSI on PHP pages work perfectly. Just when I have PHP SSI in .HTML files that it craps out.

I tried a bunch of .htaccess edits but none of them fully satisfied me as they either serve the HTML page with the PHP SSI but then non of the stand alone PHP pages worked anymore or even worse I get asked to download the file.

I have tried (without success) the following in the .htaccess:

[code]AddType application/x-httpd-php .html[/code]
Give out a: "The page cannot be displayed" error


[code]text/x-server-parsed-html .html
AddType text/x-server-parsed-html .htm [/code]
Gives me a: "500 Internal Server Error"

Also tried:

[code]AddHandler application/x-httpd-php .php .html .htm [/code]
But then it only parses half the page.

Some people suggested that I needed in my httpd.conf file:

[code]AddType text/html .shtml
AddHandler server-parsed .shtml
AddHandler server-parsed .html
XBitHack On

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml .html [/code]
My httpd.conf file is already set that way. My belief is that it can be solved with an edit on the .htaccess but cannot find the good combo of edits to make it all work as before.

Since the site is well indexed and ranked by search engine, converting all my pages to PHP is not an option. Changing to SHTML all the includes is not an option either as I have dynamic script in the PHP includes.

If you believe you can be of help to solve the problem please let me know.

- Jeremie

Share this post

Link to post
Share on other sites
[!--quoteo(post=359813:date=Mar 29 2006, 03:57 PM:name=Jeremie)--][div class=\'quotetop\']QUOTE(Jeremie @ Mar 29 2006, 03:57 PM) [snapback]359813[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]AddHandler application/x-httpd-php .php .html .htm[/code]
But then it only parses half the page.
After some suggestions form another forum I dod as follow to make it all work:

Since the HTML is now parse PHP let's forget about SSI and include the PHP as PHP within the HTML

?> [/code]
It did it.

Problem solved.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.