I use PHP's
virtual() directive quite a lot on one of my sites, including central elements. This worked fine for the last ~10 years -- but after upgrading to 12.04 it somehow got broken.
Example setup (simplified)
To make it easier to understand, I simplify some things (contents). So say I need a HTML fragment like
<P>For further instructions, please look <A HREF='foobar'>here</P> in multiple pages. 10 years ago, I used SSI for that, so it is put into a file in a central place -- so if e.g. the targeted URL changes, I only need to update it in one place. To serve multiple languages, I have Apache's
MultiViews enabled -- and at
$DOCUMENT_ROOT/central/ there are the files:
foobar.html(English variant, and the default)
Now in the PHP code, I simply placed:
<? virtual("/central/foobar"); ?>
and let Apache take care to deliver the correct language variant.
As said, this worked fine for about 10 years: German visitors got the German variant, all others the English (depending on their preferred language). But after upgrading to Ubuntu 12.04, it no longer worked: Either nothing was delivered from the
virtual() command, or (in connection with framesets) it even ended up in binary gibberish.
Trying to figure out what happens, I played with a lot of things. I first thought
MultiViews was (somehow) not available anymore -- but calling
http://<server>/central/foobar showed the right variant, depending on the configured language preferences. This also proved there was nothing wrong with file permissions. The
error.log gave no clues either (no error message thrown).
Finally, just as a "last ressort", I changed the PHP command to
<? virtual("central/foobar.html"); ?> -- and that very same file was in fact included. But the language dependend stuff obviously did no longer work.
Of course I tried to find some change (most likely in PHP's
virtual() command), using Google a lot, and also searching the questions here -- unfortunately to no avail.
Finally: The question
Putting "design questions" aside (surely today I would design things differently -- but at least currently I miss the time to change that for a quite huge amount of pages): What can be done to make it work again? I surely missed something -- but I cannot figure out what...
My remaining problem now is that as soon as the document needs to be negotiated (e.g. has different language variants),
virtual() always adds the content at the very beginning of the generated document (i.e. in front of the
<HTML> tag) -- regardless where it was placed. It however gets placed correctly when no negotiation is involved.
Any idea what's going on there, and how to fix it?