dstonek
dstonek

Reputation: 975

Undefined index: HTTP_ACCEPT_ENCODING

I use quickcache from http://sourceforge.net/projects/quickcache to have some dynamic pages cached for some time

In my server [HTTP_ACCEPT_ENCODING] => gzip, deflate

but from quickcache_main.php

if (strpos($_SERVER["HTTP_ACCEPT_ENCODING"],'x-gzip') !== false) 

and

if (strpos($_SERVER["HTTP_ACCEPT_ENCODING"],'gzip') !== false) {

is invoked I get the title error in error_log. I don't see any problem loading those cached pages from a mysql table or accessing a not cached (or expired) page when the scripts creates the new cached one. I also never saw my tests triggered a new error log like the title. Anyway I see them very frequently listed. What I am missing?

Upvotes: 3

Views: 8067

Answers (1)

Alexander Savin
Alexander Savin

Reputation: 2012

Change your code to:

if (!isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
    ob_start();            
}
elseif (strpos(' ' . $_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') == false) {
    if (strpos(' ' . $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') == false) {
        ob_start();
    }
    elseif(!ob_start("ob_gzhandler")) {
        ob_start();
    }   
}
elseif(!ob_start("ob_gzhandler")) {
    ob_start();
}

Upvotes: 4

Related Questions