Only blank pages
Symptoms
In a newly-installed system (or one previously installed but migrated to a new host) accessing any page (including the home page and other pages that are known to exist) results in nothing but a blank page in the browser.Cause
Analysis
Check if the host that Wikka is installed on is inserting banners in your pages. The way to check is to install a plain HTML page (so Wikka can be avoided). Many free (and some very cheap) hosts insert a banner. If your host does indeed insert a banner, the workaround below can provide a solution.Technical explanation
When a (free) host inserts a banner, it interferes with two things Wikka does by default:- when Gzip-encoding is active, inserting a banner just messes things up (causing the blank page); and
- Wikka calculates content-length for a HTTP header - which will be incorrect after the banner is inserted, so you would see a truncated page when Gzip is not active.
Applies to
Any Wikka version.Solution
A new configuration value and a small change in the code can provide a workaround for banner insertion causing blank pages or truncated pages.Configuration
First, open /wikka.config.php (after allowing write access on it!) and find the line "wikiping_server" => "",
(or possibly there's a value after the =>) and add the following line right after it:
"banner_insert" => "1",
to indicate your host inserts banners in your Wikka's output. (Make the file read-only again after editing it).Main program
Then open /wikka.php and find this code at the end:$content = ob_get_contents();
if (strstr ($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') )
{
// Tell the browser the content is compressed with gzip
header ("Content-Encoding: gzip");
$page_output = gzencode($content);
$page_length = strlen($page_output);
} else {
$page_output = $content;
$page_length = strlen($page_output);
}
// header("Cache-Control: pre-check=0");
header("Cache-Control: no-cache");
// header("Pragma: ");
// header("Expires: ");
$etag = md5($content);
header('ETag: '.$etag);
header('Content-Length: '.$page_length);
ob_end_clean();
echo $page_output;
and change it as follows:
if (strstr ($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') )
{
// Tell the browser the content is compressed with gzip
header ("Content-Encoding: gzip");
$page_output = gzencode($content);
$page_length = strlen($page_output);
} else {
$page_output = $content;
$page_length = strlen($page_output);
}
// header("Cache-Control: pre-check=0");
header("Cache-Control: no-cache");
// header("Pragma: ");
// header("Expires: ");
$etag = md5($content);
header('ETag: '.$etag);
header('Content-Length: '.$page_length);
ob_end_clean();
echo $page_output;
$content = ob_get_contents();
// if host inserts banner but supports gzip we prevent gzip encoding by setting 'banner_insert' to '1' in the configuration
if (strstr ($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') && $wakka->config['banner_insert'] == '0')
{
// Tell the browser the content is compressed with gzip
header ("Content-Encoding: gzip");
$page_output = gzencode($content);
header('Content-Length: '.strlen($page_output));
} else {
$page_output = $content;
// if host inserts banner we don't want content-length calculation to prevent page truncation in the browser
if ($wakka->config['banner_insert'] == '0')
{
header('Content-Length: '.strlen($page_output));
}
}
// header("Cache-Control: pre-check=0");
header("Cache-Control: no-cache");
// header("Pragma: ");
// header("Expires: ");
$etag = md5($content);
header('ETag: '.$etag);
//header('Content-Length: '.$page_length); # moved
ob_end_clean();
echo $page_output;
// if host inserts banner but supports gzip we prevent gzip encoding by setting 'banner_insert' to '1' in the configuration
if (strstr ($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') && $wakka->config['banner_insert'] == '0')
{
// Tell the browser the content is compressed with gzip
header ("Content-Encoding: gzip");
$page_output = gzencode($content);
header('Content-Length: '.strlen($page_output));
} else {
$page_output = $content;
// if host inserts banner we don't want content-length calculation to prevent page truncation in the browser
if ($wakka->config['banner_insert'] == '0')
{
header('Content-Length: '.strlen($page_output));
}
}
// header("Cache-Control: pre-check=0");
header("Cache-Control: no-cache");
// header("Pragma: ");
// header("Expires: ");
$etag = md5($content);
header('ETag: '.$etag);
//header('Content-Length: '.$page_length); # moved
ob_end_clean();
echo $page_output;
Other host?
If you later move the site to another host that doesn't insert banners, just change the config to set 'banner_insert' to '0' and you'll get gzip encoding enabled again, as well as content-length calculation. Using Gzip encoding costs a little extra in CPU but saves on bandwidth.Refinement
Even if after the workaround outlined here you no longer have blank or truncated pages, some pages may still not display properly, depending on content and on the browser used. If you use Internet Explorer you may not see this but people using a more standards-compliant browser like Firefox may see the page content overlapping the page footer. This can be fixed (at least in most cases) with a small tweak to the default stylesheet:- edit /css/wikka.css
- find the entry for .page
- at the end this has the rule:
height: 100%;
- change this to:
height: auto;
CategoryWorkaround