Welcome to WebmasterWorld Guest from 54.145.117.60

Forum Moderators: Ocean10000 & incrediBILL & phranque

Gzip compression - other things to compress

     
7:12 am on Oct 3, 2017 (gmt 0)

Junior Member

10+ Year Member

joined:May 20, 2006
posts: 73
votes: 0


I have gzip compression enabled on my server for faster browsing.

I have below setup in my cPanel >> Optimize Website >> Compress Content
-----
Compress the specified MIME types.
text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
-----

Recently, I've been using a few PHP scripts, too, especially Formmail that is programmed with PHP. Do you recommend that PHP scripts are compressed, too? If so, how will I change the above code so that PHP is added as one of the MIME types ?
8:39 am on Oct 3, 2017 (gmt 0)

Senior Member

WebmasterWorld Senior Member topr8 is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 19, 2002
posts:3329
votes: 30


you don't serve php scripts to the client ... only the output returned by the script (on the server), which would normally be served as text/html
9:39 am on Oct 3, 2017 (gmt 0)

Junior Member

10+ Year Member

joined:May 20, 2006
posts: 73
votes: 0


In my settings above javascript is included in MIME types. So if scripts don't serve to the client, does it mean this portion "text/javascript application/javascript application/x-javascript" is also not necessary?
10:45 am on Oct 3, 2017 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11080
votes: 106


whether the response that serves the html document or javascript is generated by a php script or by a static file doesn't matter to the output filter stage where gzip compression occurs.
at that point the response body is already transmitted with the MIME-type specified in the Content-Type header.
therefore as long as your php script is serving html documents with the text/html MIME-type specified they should be compressed with your cpanel configuration setting.
11:06 am on Oct 3, 2017 (gmt 0)

Moderator from US 

WebmasterWorld Administrator keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:10114
votes: 550


So if scripts don't serve to the client, does it mean this portion "text/javascript application/javascript application/x-javascript" is also not necessary?
topr8 said the PHP process doesn't get compressed, only the output. That doesn't mean *all* scripts.

JavaScript is user-side, meaning the browser downloads the script and runs it... So yes, compressing JavaScript is preferred.

However you should check with your server admin or support team to see if all those JS compression types are supported.
11:07 am on Oct 3, 2017 (gmt 0)

Junior Member

10+ Year Member

joined:May 20, 2006
posts: 73
votes: 0


I see. In that case, I will leave the settings as is then.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members