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

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

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

Post 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
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Did you restart Apache?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Post 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.
Post Reply