PDA

View Full Version : Parse php in .shtml file


Xallow
07-30-2008, 05:13 PM
As the title states, I need to parse php in my index.shtml file.

I have tried the following in my .htaccess:

AddType x-mapp-php4 .html .htm .shtml
removeHandler server-parsed shtml

AddType application/x-httpd-php3 .shtml

RemoveHandler .shtml
AddType application/x-httpd-php .shtml

AddType application/x-httpd-php .shtml

With all of them the result is that when I go to the url, I am asked if I want to download the file.

I am at a loss here |huh

cd34
07-30-2008, 05:52 PM
Do you need to parse both SSI and php in the page? If so, you would require apache2 which can do that with the addition of a handler. I don't quite remember which order pages are parsed in, but, I believe you set it to parse .php first, then, AddOutputFilter INCLUDES

If you are running apache2, and want to parse .shtml pages for php only, the following will do that:


RemoveHandler .shtml
AddType application/x-httpd-php .shtml


If you are running apache1, I believe the above should work. If your host is running fastcgi, it might not react the same way and then you need to get them involved.

Xallow
07-30-2008, 06:58 PM
A traffic trade script needs the page to be .shtml I have unfortunately tried the

RemoveHandler .shtml
AddType application/x-httpd-php .shtml

and it didn't work, it simply asked if I wanted to download the file :( I guess I will have to talk to the host about it

cd34
07-30-2008, 07:11 PM
does the page load if you run it as index.php?

if so, remove index.shtml and put the following in your .htaccess


RewriteEngine on
RewriteRule ^index.shtml$ index.php [L,QSA]


I'm assuming you have tons of links pointed at index.shtml and can't use a new page, but, the above will probably fix it without having to involve your host -- and if you are in a virtual environment, they may not be willing to enable the permissions to allow those directives, or, its possible that you're running php under fastcgi and the directive isn't quite doing what you need.

Xallow
07-31-2008, 03:49 AM
It is actually a new site I am creating so I don't have anything pointed at anything yet. I will give it a try as soon as I get home from my extremely tedious day job :)