0

mod_deflate not working for php generated page. I have Apache v2.4.7 with php v5.5.9 on Ubuntu 14.04.5 (LTS). This module is working for static html pages and other files like CSS, js etc.

here is my php information http://www.hostnology.com/test.php

Thamaraiselvam
  • 6,961
  • 8
  • 45
  • 71
Sunny
  • 119
  • 2
  • 18
  • Note that [PHP 5.5 has been entirely unsupported for over a year](http://php.net/supported-versions.php) (it doesn't even receive security updates anymore). Furthermore, [PHP _5.5.9_ is an ancient version of the obsolete PHP 5.5 branch](http://www.php.net/ChangeLog-5.php#5.5.9), nearly 3.5 years old. _**Please** upgrade to a supported version of PHP_. Upgrading your OS to a newer version of Ubuntu, like [16.04 LTS](http://releases.ubuntu.com/16.04/), is also a good idea and may help with the PHP upgrade. – ChrisGPT was on strike Jul 30 '17 at 15:10
  • @Chris it was working fine on my old server with Apache2.2 and php5.3 – Sunny Jul 31 '17 at 05:42
  • 1
    Sunny, I'm not trying to answer your question. I'm trying to give you some valuable advice: Don't just upgrade from PHP 5.3 to PHP 5.5 (and especially not to version 5.5.9). PHP 5.5 is almost as bad as PHP 5.3 from a security perspective. _Please_ upgrade to at least version 5.6, which is the last version of PHP 5 that will be released and has therefore been given an extended security support period (until December 31, 2018). – ChrisGPT was on strike Jul 31 '17 at 12:49
  • your test.php sends `Content-Encoding: gzip`, so the page is gzipped. Note, the module do this due to a client's header `Accept-Encoding: gzip`. – Deadooshka Aug 21 '17 at 03:49
  • @Deadooshka I can't see **Content-Encoding: gzip** using command `curl -I -H "Accept-Encoding: gzip, deflate" http://www.hostnology.com/test.php` – Sunny Aug 21 '17 at 04:47
  • 1
    `-I` option means HEAD request method, so there is nothing to compress. Try `curl -i -H "Accept-Encoding: gzip" http://www.hostnology.com/test.php` or even better `curl -i --compressed http://www.hostnology.com/test.php` – Deadooshka Aug 21 '17 at 07:39

1 Answers1

1
  • Only content is deflated, if you use HEAD http verb, there is no content, so no need to deflate it
  • You can set (or there is) parameter in httpd that activate deflate on some mime type. (no need to deflate jpeg for instance)
  • if content type is small (like <1k) there no point to deflate (size almost same)
wargre
  • 4,575
  • 1
  • 19
  • 35
  • you are right its working but not showing in curl. I can see it now with this command `curl -L -v -s -H 'Accept-Encoding: gzip,deflate' -o /dev/null http://www.hostnology.com/test.php` – Sunny Aug 22 '17 at 06:18