Forum Moderators: phranque

Message Too Old, No Replies

testing server configuration

htaccess and forcetype

         

TGecho

4:21 am on Dec 16, 2003 (gmt 0)

10+ Year Member



I've got apache installed on a computer for developing php scripts, but I'm having trouble figuring out all of the settings.

I'm trying to use htaccess and forcetype to create "friendly" urls. I have a file named "test" and the htaccess file has this in it:

<FilesMatch test>
ForceType application/x-httpd-php
</FilesMatch>

When I upload this to my (real) webserver, it works exactly as expected. However locally it prompts me to download the file. I've tried a few things, but I really don't even know where to look.

Any hints?

jdMorgan

5:07 pm on Dec 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your browser may not know what to do when it receives a response with that MIME-type. Since php should be handled server-side, it's usual to 'lie' about the MIME-type of php files, and tell the browser what the MIME-type of the php file's *output* is.

Try taking another look through the mod_mime documentation and see if that sheds any light on the problem.

Jim

TGecho

4:12 am on Dec 18, 2003 (gmt 0)

10+ Year Member



Thanks Jim, that was exactly the problem.

For future reference, apache wasn't configured to use php on files with application/x-httpd-php as their mimetype.

To fix this, I added this line to httpd.conf:
Action application/x-httpd-php /php/php.exe

This tells apache what to do with files that have that mimetype.

Thanks again!