Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running Apache + PHP and all the places in my site that use gzip (E.g. CSS in WordPress) no longer loads and just shows a black question mark. I have no idea where to look for the error.

enter image description here

My test script is this:

<?php
header( 'Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 1209600 ) );
header( 'Content-type: text/css; charset=UTF-8' );

$http_accept_encoding = $_SERVER["HTTP_ACCEPT_ENCODING"];

if ( strpos( $http_accept_encoding, 'x-gzip' ) !== FALSE ) {
        $encoding = 'x-gzip';
} else if( strpos($http_accept_encoding,'gzip') !== FALSE ) {
        $encoding = 'gzip';
} else {
        $encoding = FALSE;
}

if ( $encoding ) {
        header( 'Content-Encoding: ' . $encoding );
        echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
}

$output = 'Hellooooooooooooooo World';


if ( $encoding ) {
        echo gzcompress( $output, 9 );
} else {
        echo $output;
}

And the output is here:

http://brandonwamboldt.ca/css.php

It's also inconsistent, sometimes it will load properly sometimes it won't

share|improve this question
    
What was the last thing you changed just before it stopped working. –  EightBitTony Jun 20 '12 at 11:20
    
I updated the OS via yum update –  Brandon Wamboldt Jun 20 '12 at 11:21
    
Then you need to find out which config file it changed, and revert those changes. Look around the Apache and PHP config files and find out which have been modified. –  EightBitTony Jun 20 '12 at 11:33
1  
...more likely to be a change in the libs than the config to cause this. That it's only returning a single character makes me think that maybe gzcompress is returning false. –  symcbean Jun 20 '12 at 11:48
add comment

1 Answer

up vote 1 down vote accepted

I'm not exactly what caused the issue, but I rolled back to PHP 5.4.3 from PHP 5.4.4 and the problem no longer occurs (Same config files). Putting PHP 5.4.4 back causes the issue again.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.