Project

General

Profile

Parse single .html file as PHP?

Added by ksoftware almost 14 years ago

I have a single file with the extension .html that I need to parse as PHP. Unfortunately the file extension can't be changed. Is there a way to handle that?


Replies (4)

RE: Parse single .html file as PHP? - Added by nitrox almost 14 years ago

You can map extensions, see wiki.

RE: Parse single .html file as PHP? - Added by ksoftware almost 14 years ago

Right, but I don't want to map all .html to PHP - just one single file (out of tens of thousands).

One of the main reasons this site I'm migrating to Lighttpd was memory problems and it's no wonder since they were sending every single file through PHP!

I tried :

fastcgi.server             = ( "/full/path/to/file/example.html" =>
                               ( "localhost" =>
                                 (
                                   "socket" => "/tmp/php-fastcgi.socket",
                                   "bin-path" => "/usr/bin/php-cgi" 
                                 )
                               )
                            )

... but it doesn't seem to work.

RE: Parse single .html file as PHP? - Added by ver almost 14 years ago

enclose the ".html" => "php" mapping within a $HTTP["url"] =~ "^/path/to/your/file.html" { } block.

RE: Parse single .html file as PHP? - Added by ksoftware almost 14 years ago

Brilliant!

For some reason the conditionals didn't click until I read this reply. For some reason I didn't think you could nest them (I also wanted to only do that for one vhost).

Thanks!

    (1-4/4)