Knowledge Base | Faq | IPanel
Forced ads are causing problems with customers' PHP scripts
Q: Some of my clients are complaining that forced ads are causing problems in their PHP scripts. How do I fix this?
Please ask your client to check admin area of his script to see if a GZip compression setting exists. This MUST be turned off as gzipped output is not compatible with forced ads. You may need to temporarily disable the ads for the client's account in the client's profile area to allow them access to their admin area, then re-enable forced ads when they have disabled GZip compression.
We suggest editing your welcome email with instructions to disable GZip compression for any scripts they install.
The only PHP scripts known not to work with the forced ads are a few photo galleries which have gzip compression hard coded into the script.
Q:Can't you add some kind of workaround? A:Unfortunately no, due to the way PHP and Apache modules work that's not possible.
Without going into great technical detail, the way it works internally is 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 BODY HTML 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 BODY HTML tag -- it'll just find binary data. As a result it will just put the ads at the beginning and end of the gzipped binary data, which will result in an output page which your browser can't render as anything but an ad header followed by junk binary data followed by an ad footer.
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 huge amount of overhead to compress the page in PHP and then decompress it in the forced-ads module, and it would be totally wasted effort.
As a rule, 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. PHP's gzip compression will only compress HTML output generated by PHP, whereas Apache's will compress ALL HTML output, including HTML generated by PHP and static documents (*.html, *.js, *.css, etc.) which will lead to far better bandwidth savings and will NOT interfere with forced ads.