# Mod\_gzip with php

**URL:** <https://www.ruby-forum.com/t/mod-gzip-with-php/190927>\
**Category:** NGINX\
**Created:** [July 1, 2010, 12:35am UTC](https://www.ruby-forum.com/t/mod-gzip-with-php/190927 "2010-07-01T00:35:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roman\_V](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@Roman\_V](https://www.ruby-forum.com/u/Roman_V)\
**Post date:** [July 1, 2010, 12:35am UTC](https://www.ruby-forum.com/t/mod-gzip-with-php/190927/1 "2010-07-01T00:35:50Z")

</div>

Hello,

# I found strange behavior for php scripts. when server request is HEAD, I can see some garbage in response.

HEAD /server.php HTTP/1.1  
Host: [www.rss2search.com](http://www.rss2search.com)  
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6)  
Gecko/20100625 Firefox/3.6.6  
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,_/_;q=0.8  
Accept-Language: en-us,en;q=0.5  
Accept-Encoding: gzip,deflate  
Accept-Charset: ISO-8859-1,utf-8;q=0.7,\*;q=0.7  
Keep-Alive: 115  
Connection: keep-alive  
Content-Length: 0  
Content-Type: text/plain; charset=UTF-8

HTTP/1.1 200 OK  
Server: nginx/0.8.39  
Date: Wed, 30 Jun 2010 20:00:33 GMT  
Content-Type: text/html  
Connection: keep-alive  
X-Powered-By: PHP/5.1.6  
P3P: CP=“NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM”  
Content-Encoding: gzip

…  
this noneprintable bytes is: 1F8B080000000000000303000000000000000000

Helped to fix that disabling mod\_gzip for HEAD requests in fastcgi.conf.  
if ( $request\_method = HEAD ) {  
gzip off;  
}

Is this behavior expectible, if so, what best way for nginx.conf to fix  
this problem?
