Page 1 of 1

My PHP is showing as plain text with <Files> directive

Posted: Sun Feb 11, 2007 1:14 pm
by mjseaden
Hi,

I'm trying to get Apache to read some extensionless files, specifically named, as PHP files and hence call the PHP module to process them. In my .htaccess file, I've placed the following directive:

Code: Select all

<Files audix>
   ForceType application/x-httpd-php
</Files>
My hope is that 'audix' will run as a PHP file, if executed in the same directory. However, when I run it, it's showing as plain text in my browser suggesting it isn't working. Is there something wrong with my syntax? PHP is working fine for files with a .php extension.

Many thanks

Posted: Sun Feb 11, 2007 1:56 pm
by RobertGonzalez
Did you restart Apache?

Posted: Sun Feb 11, 2007 2:00 pm
by volka
http://httpd.apache.org/docs/2.2/mod/core.html#forcetype wrote:Description: Forces all matching files to be served with the specified MIME content-type
Syntax: ForceType MIME-type|None
Context: directory, .htaccess
Override: FileInfo
Status: Core
Module: core
Compatibility: Moved to the core in Apache 2.0
Do you have sufficient override permissions? see http://httpd.apache.org/docs/2.0/mod/co ... owoverride

Posted: Sun Feb 11, 2007 2:10 pm
by mjseaden
Thanks volka, that's it. I've changed the httpd.conf file line from

Code: Select all

AllowOverride None
To

Code: Select all

AllowOverride FileInfo
Within the <directory > directive for my 'htdocs' folder, and it's now reading my .htaccess files and running the extensionless files as PHP files.

Thanks very much.