View Full Version : PHP and SSI on 1 page
Hi...
I want to use both PHP and SSI on my page. Does anyone know what I can put in my .htaccess to make the server parse both PHP and SSI. I think it would help me a lot because I want to use some PHP and some SSI on my page. I'm pretty sure it can be done, I just don't know how :)
Also, one important detail: If I have to have a specific ending, I'd much rather it be .shtml and not .php
Or, what would be even better would be if I could have the server parse the PHP and SSI in an .html page. Whichever is easier is cool. But I really do not want to have a .php ending if I don't have to.
Thanks in advance for the help. I truly hope this is possible.
P.S. This doesn't pose some kind of security risk does it? I hope not.
winzor
03-18-2001, 10:30 AM
I have a script that will convert SSI to php if that will help.
hmm... that might help. Sounds cool. Do you want to upload it to this thread (if it is allowed, I dunno the permissions set on this board) or do you want to send it through e-mail? Thanks in advance
winzor
03-18-2001, 12:43 PM
I sent you a private message where you can use it.
cool
This is what I put in the text box:
<!--#config timefmt="%m/%d/%Y"--><!--#echo var="LAST_MODIFIED"-->
This is what came out:
<? echo date("m/d/Y", filemtime($SCRIPT_FILENAME)); ?>
Does that look right? I'm new to PHP so I dunno if the code given to me will work or not.
mark_olson
03-18-2001, 01:10 PM
I know that you can get it to parse the SSI in HTML documents by going into 'Apache Handlers', putting .html for the extension, and server-parsed as the handler.
If anyone knows how to get PHP to be recognized in a standard .html, I'd be interested to hear.
mark_olson
03-18-2001, 01:16 PM
extension = .html handler = application/x-httpd-php
Is what to do to parse php in .html documents.
But I can't get them both to work.
Any ideas?
winzor
03-18-2001, 02:22 PM
Mike,
The output looks like valid php code. I would test it in a test page first though.
Hope it works for you.
Mark,
Can you put the code to enable PHP parsing in HTML files in the .htaccess file, and if you can, what should I put.
I want to enable parsing in a subdirectory to test this before destroying my site.
Thanks,
Allen
After searching around on the web I worked out what it should be:
AddType application/x-httpd-php .html
AddHandler application/x-httpd-php .html
These lines in the .htaccess file enable PHP parsing in HTML files.
Now I wonder how much slower this will make the site
Allen
clio360
07-29-2001, 08:55 PM
will not do any security harm, i don't think.
I don't understand why you still need the SSI tag.
If you wanted to do this:
<!--#exec cgi="/Banner.cgi"-->
just do this instead:
<?php virtual ("/path/to/Banner.cgi"); ?>
and if it's just a file include like header.txt change "virtual" to include.
You're better off changing all your file extensions to .php so they'll be parsed as PHP. You're not only slowing your own site down, but potentially others as well.
Clio,
The reason I want to use the .HTML extension for PHP files is probably different. I used to use SSI, but am changing to PHP so that at some future point I can make the site database driven.
However, our local cable company offers Internet access through the TV, but the browser is pretty basic, and it won't load a page with the .PHP extension.
All my pages will have at least one bit of PHP (the date at the bottom), and probably the navigation bar and some includes for headers and footers.
Allen
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.