coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 PHPnuke/Postnuke Support => Topic started by: DJMaze on November 10, 2003, 07:40:09 PM

Title: File download or strange text in IE or Opera browsers
Post by: DJMaze on November 10, 2003, 07:40:09 PM
This is caused when running an Apache 2.x server with PHP 4.3.3 or less.
Upgrade to PHP 4.3.4 if you use Apache 2 webserver.

This is caused by ob_flush() a command which is not properly translated to plain text in PHP to Apache 2.
So you get binary data instead of text output.
IE and Opera recognize the file as "binary" while it's actualy a text file.

If you don't believe me here is the bug post on php site:
http://bugs.php.net/bug.php?id=25701

NOTE: This bug isn't noticed in Mozilla and Netscape browsers.
Title: File download or strange text in IE or Opera browsers
Post by: TheOne on November 25, 2003, 09:49:28 PM
Hmmm, the problem is still there, even when i have updated the phpserver to version 4.3.4.

You can see on this url, that it is 4.3.4.
//www.gmc.christiannissen.dk/analyze.php

You can also see the binary output on this page.
http://www.gmc.christiannissen.dk/modules.php?name=coppermine

I am running apache 1.3... and 2....


Any ideas??
Title: File download or strange text in IE or Opera browsers
Post by: DJAxion on December 01, 2003, 08:19:33 AM
Having the same problem as above: apache 2, php 4.3.4. Any solutions?
Title: File download or strange text in IE or Opera browsers
Post by: DJAxion on December 02, 2003, 11:09:38 PM
I found something that worked for me:
(Apache2, php 4.3.4)

In mainfile.php:
edit
if ($phpver >= '4.0.4pl1' && strstr($HTTP_USER_AGENT,'compatible')) {
    if (extension_loaded('zlib')) {
        ob_end_clean();
        ob_start('ob_gzhandler');
    }
} else if ($phpver > '4.0') {
    if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
        if (extension_loaded('zlib')) {
            $do_gzip_compress = TRUE;
            ob_start();
            ob_implicit_flush(0);
            //header('Content-Encoding: gzip');
        }
    }
}


in

if ($phpver > '4.0') {
    if (strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
        if (extension_loaded('zlib')) {
            $do_gzip_compress = TRUE;
            ob_start();
            ob_implicit_flush(0);
            //header('Content-Encoding: gzip');
        }
    }
}


It may not be the best solution, but it works for me, any thoughts about this :?: