httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kent Larsson" <>
Subject Re: [users@httpd] Dynamic text-file created by PHP
Date Sat, 26 Jan 2008 08:47:36 GMT
> On 25.01.08 06:59, Kent Larsson wrote:
> > I want to create a dynamic textfile using PHP for each request of it. If the
> > users asks for http://server/textfile.txt I want a PHP-script to execute and
> > serve the textual data completely transparent to the user. This is a "single
> > case" so associating all txt-files with PHP is not what I would like to do.
> >
> > Which method would be the cleanest to use in this case? It's not a complex
> > rewrite.
> you can make the .txt a php script and force pargins by php parser by using
> <Files> and SetHandler

Thank you! But I still don't get it to work.

Some output: (cat shows the contents of a text file and $ is my command prompt)

$ cat txtfilefromphp.txt
echo 'This should be a text-file';

$ cat .htaccess
<Files "txtfilefromphp.txt">
  SetType application/x-httpd-php

When I surf to it I still get:
echo 'This should be a text-file';

Which means that it's interpreted as normal text file. I would like
the user to read the echo line and think (s)he is reading a normal
text file, not a dynamically generated one.

Step one is getting PHP to parse the script. After that I'll have to
imitate the http-header so that it exactly matches a normal text file.
But I'm still having problems with step one.

Has anyone got any suggestions?

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message