Forum Moderators: phranque

Message Too Old, No Replies

About apache ReadmeName and HeaderName...

only for .htm?can't be .php?

         

Shawn_cn

4:49 pm on Dec 13, 2003 (gmt 0)

10+ Year Member



i open my IE to visit my own web.Apache is running,after i edited the httpd.conf as following:
ReadmeName Foot.htm
HeaderName Head.htm
so, i see the result.

but when i use .php file instead of .htm file, it can't show.

does apache support Head.php as HeaderName?

jdMorgan

10:23 pm on Dec 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I suspect this is because the server does not know it has to parse the php file as php, instead of treating it as as plain text or html. In other words, the php interpreter is never invoked, so your code is not processed as code, just treated as text.

You could try embedding the php inside an html file, or perhaps use other directives (AddHandler embedded in a <Files> container?) to tell the server to parse the file as php. This is something I've never experimented with, though, so hopefully someone will come along with a more definitive answer.

Jim

Shawn_cn

3:57 am on Dec 14, 2003 (gmt 0)

10+ Year Member



thank you, jdMorgan.
but normal .php files in my web are working well.
only when they're changed to be ReadmeName file and HeaderName file, it doesn't work.
Apache ignores them as if it has no ReadmeName file...

jdMorgan

4:09 am on Dec 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, I suspect that's because the header/footer files are processed in a completely different software 'path' than regular page requests, and Apache may not have all the support for non-html pages and scripting available for what was originally intended for simple custom directory headers and footers.

Again, I've never used anything but simple headers and footers, so this is beyond my experience. Maybe someone else can help you. If not, you might want to ask over in the PHP forum, too.

Jim

Shawn_cn

4:13 am on Dec 14, 2003 (gmt 0)

10+ Year Member



Oh...i get the point.
"Both HeaderName and ReadmeName now treat Filename as a URL path relative to the one used to access the directory being indexed. Filename must resolve to a document with a major content type of "text/*"(e.g.,text/html,text/plain,etc.)..."

and then i found .php is application.
AddType application/x-httpd-php .php

jdMorgan

5:00 am on Dec 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, although as I said above, it might be worth testing to see if you can invoke php from inside an html page -- to use an html page as a "plain-text wrapper" for a php call, in other words.

Maybe it will work, and maybe not. It might be a good experiment to try anyway.

Jim