Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   Parse php in .shtml file (http://www.greenguysboard.com/board/showthread.php?t=48225)

Xallow 2008-07-30 05:13 PM

Parse php in .shtml file
 
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 2008-07-30 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:

Code:

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 2008-07-30 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 2008-07-30 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

Code:

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 2008-07-31 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 :)


All times are GMT -4. The time now is 01:56 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc