Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know if it is possible to tell Apache to pass a specific file through the php parser ?

I want to try playing with "executable images", as described here (youtube).

I know about

AddType application/x-httpd-php .jpeg

Is it possible to do it only for a specific file, though ?

share|improve this question
You can try putting this directive inside a specific directory directive. – Khaled Feb 11 '11 at 13:41
up vote 1 down vote accepted

Just like this:

<Files exec.jpg>
    DefaultType application/x-httpd-php
share|improve this answer

What if you did the detection via the php script? Say salty.jpg is the only one you want to redirect, everything else just load the jpg.

Use the above then use a php variable to detect the script name

if($_SERVER['SCRIPT_NAME'] == "salty.jpg"){
  <php code you want to run>
} else {
  <php code to load and display a jpg>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.