Here's my problem:
I've configured apache in a <VirtualHost> block with the directives:
AddType application/x-httpd-php4 .html
ErrorDocument 404 /ed/404.html
My /ed/404.html is contains the following:
---8<------8<------8<------8<---
<?
$log=fopen($DOCUMENT_ROOT.'/ed/log404', 'a');
fputs($log,"Referer: $HTTP_REFERER\n");
[some more php code]
$filename=basename($REDIRECT_URL);
$ext=substr($filename, strrchr($filename, ".")+1);
$ext=strtolower($ext);
if(($ext == "gif") || ($ext == "jpg") [...]) {
header("Content-type: image/gif\n");
readfile($DOCUMENT_ROOT."foo.gif");
} else {
header("Content-type: text/html\n\n");
?><head>
[some html code]
<? } ?>
Now, when i try to access a page that doesn't exist, let's say /blah.html, my 404.html is show. BUT BUT BUT, only the HTML CODE is shown, the php code is stripped. However, there's nothing written in my /ed/404log as requested. i tested if it wasn't just because of an error in the file opening thing, but phpinfo() doesn't show up either.
I'm turning mad, i have no idea what can be the cause of all this fuss.
Now to those who will tell me "there's just a bug in your php script", i'll answer this: when i access /ed/404.html directly in my browser, it shows up correctly, and the php code is parsed, and all goes perfect.
All i can see as a reason for this is that php, due to my apache configuration, takes all requests to *.html files. And when php can't open the html file requested, it looks at apache config, and sends the 404 page without parsing it out of removing php code.
any hints?