Expires, Gzip & PHP

Karl

Active Member
#1
Hi,

We have an issue where ExpiresByType is being ignored. Regardless of gzip being set or not, if the content comes from PHP then no expires header is set:

Code:
Connection:close
Content-Encoding:gzip
Content-Length:24
Content-Type:text/html
Date:Thu, 27 Mar 2014 11:28:58 GMT
Server:LiteSpeed
Vary:Accept-Encoding
X-Powered-By:PHP/5.4.25
Code:
Connection:close
Content-Length:4
Content-Type:text/html
Date:Thu, 27 Mar 2014 11:33:40 GMT
Server:LiteSpeed
X-Powered-By:PHP/5.4.25
I've tested this on another server that runs 4.2.7 as well and ExpiresByType does not an expires header on PHP files.

If I change the .php to a .html then it works:
Code:
Accept-Ranges:bytes
Cache-Control:max-age=2592000
Connection:close
Content-Length:4
Content-Type:text/html
Date:Thu, 27 Mar 2014 11:49:32 GMT
ETag:"4-53341044-fca806447c8f097c"
Expires:Sat, 26 Apr 2014 11:49:32 GMT
Last-Modified:Thu, 27 Mar 2014 11:49:24 GMT
Server:LiteSpeed
The only difference between those two tests is that the first is a file called test.php and the second test.html - the content is exactly the same.

Code:
ExpiresByType text/html A2592000
Is what is set in the .htaccess

Thanks,
 

NiteWave

Administrator
#2
I did tests on both apache and litespeed/4.2.5

you're right. the .htaccess is
Code:
ExpiresActive On
ExpiresByType text/html A2592000
apache will add response headers:
Code:
Cache-Control: max-age=2592000
Expires: Sun, 27 Apr 2014 02:34:15 GMT
for both .php and .html

litespeed will add above 2 headers to .html but not to .php

however, not test gzip yet. here's full headers for the test.php (after ExpiresActive On)

under apache:
Code:
HTTP/1.1 200 OK
Date: Fri, 28 Mar 2014 02:30:50 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.4.21
Cache-Control: max-age=2592000
Expires: Sun, 27 Apr 2014 02:30:50 GMT
Content-Length: 4
Connection: close
Content-Type: text/html; charset=UTF-8
under litespeed
Code:
HTTP/1.1 200 OK
Content-Encoding: gzip
Vary: Accept-Encoding
Date: Fri, 28 Mar 2014 02:33:24 GMT
Server: LiteSpeed/4.2.5 Enterprise
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
X-Powered-By: PHP/5.4.22
Content-Type: text/html; charset=UTF-8
Content-Length: 24
 
Last edited:
Top