Php sites are broken with forced ads


Php sites are broken with forced ads


Q: When i enable forced ads all my sites running php scripts show just the ads and nothing else.

A: Any script which forces PHP to generate gzipped content will never be compatible with an Apache module that expects HTML input. The reason should be self-explanatory to those with some apache knowledge -- PHP generates a page, passes it to Apache, and then Apache passes it to the forced ads module (be it mod_layout, our custom mod_forcedads, or any other forcedads module) and the forced-ads module parses the page looking for tags and inserts the ads.

If PHP's generated "page" is really gzipped binary data, then the forced-ads module is never going to find a tag. What will happen then is it'll just put the ads at the beginning and end of the binary data, which will result in something your browser can't render as anything but junk binary data.

The only way to work around this would be to have our forced-ads module unzip the gzipped content before processing it, but that would be patently silly -- it would generate a ton of overhead to compress the page in PHP and then decompress it in the forced-ads module, and it would be totally wasted effort. Just turn off any output compression in your PHP script and you'll be fine.

Regardless of whether you're using forced ads or not, if you need output compression, that should always be done using Apache's gzip module, not PHP's, as that will ensure that static HTML pages are compressed too.