Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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)
  • (German variant).

Now in the PHP code, I simply placed:

<? virtual("/central/foobar"); ?>

and let Apache take care to deliver the correct language variant.

The problem

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

Addition (EDIT)

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?

share|improve this question

1 Answer 1

As the "binary gibberish" mentioned above made me curious, I investigated a bit further and copy-pasted it into a file named foo.gz, and ran gzip -d foo.gz. As already suspected, this yielded no error message (though the output still was gibberish -- just different gibberish). Comparing the /etc/apache2/mods-enabled on my new machine with a similar setup on an older machine turned up mod_deflate being enabled on the new machine. So I removed that from the enabled mods (by simply deleting the symbolic links deflate.conf and deflate.load), reloaded Apache... problem solved. At least it looks like...


Only the "gibberish part" is solved by disabling mod_deflate. Remaining issue: As soon as the link passed to virtual() triggers mod_negotiation (i.e. the MultiViews part), the included text is moved to the very top of the output (i.e. in front of the <HTML> tag), which breaks most pages. If the targeted link does not need to be negotiated, the included text is placed correctly. Very confusing.

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.