Check and Use GZIP Compression through PHP

Back to Blog
gzip compress hire web designers in mira road mumbai - ezeelive technologies

Check and Use GZIP Compression through PHP

gzip compression is using for increase website speed and save server bandwidth. Read the below points to add gzip compression in your website:

1. Ask Hosting server provider to enable gzip compression.
2. Compress all the CSS and js file using 7-zip e.g. if your CSS file name is style.css it will save as style.css.gz.
3. Upload all the file on live server and set Content Encode GZIP to .gz files
4. Define gzip global variable in your common PHP file (remember the common file will include in all the PHP file into your website)

 $gzip_string="";
 if (substr_count($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip"))
 {
 $gzip_string=".gz";
 }else{
 $gzip_string="";
 }

5. Put defined variable in all your script and style including in your PHP pages e.g.

 <link rel="stylesheet" type="text/css" href="css/my-style-file.css<?php echo $gzip_string;?>" />
 <script type="text/javascript" src="js/my-script-file.js<?php echo $gzip_string;?>"></script>

If you face any problem in gzip compression you can Contact or Skype on ezeelive

Summary
Check and Use GZIP Compression through PHP
Article Name
Check and Use GZIP Compression through PHP
Description
Enabling GZIP compression saves bandwidth and increase website response time, check and use gzip compression through php in web application.
Author
Publisher Name
Ezeelive Technologies
Publisher Logo

Share this post

Comment (1)

  • Veem Reply

    Generally Receive a Next Viewpoint

    March 11, 2014 at 1:35 am

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to Blog