Compressing Pages
#1
Posted 27 May 2008 - 11:14 PM
This dead simple mod compresses pages at the server as they delivered to the client browser (if it supports compression) using gzip.
It can give upto 80% reduction in size, so speed download, there is no extra load to server.
There is a option in admin, so if you have that 'on' don`t apply this to the client side.
This can be done for any php document.
In application_top.php both on client side & admin, near the top, after <?php
add:
ob_start("ob_gzhandler");
Thats it, you should notice a speed increase on loading admin pages immediatly, client pages will be faster, especially if using dial-up.
I have`nt found any downside to date.
Remember, What you think I ment may not be what I thought I ment when I said it.
Contributions:
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al.
#2
Posted 28 May 2008 - 10:38 PM
#3
Posted 28 May 2008 - 10:54 PM
NimaP, on May 28 2008, 11:38 PM, said:
IE 3 & older, Opera 4 & older Netscape 3 & older, and certain versions of firefox (not sure which)
Remember, What you think I ment may not be what I thought I ment when I said it.
Contributions:
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al.
#4
Posted 29 May 2008 - 04:50 PM
// if gzip_compression is enabled, start to buffer the output
if ((GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) &&
(PHP_VERSION >= '4')) {
if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {
if (PHP_VERSION >= '4.0.4') {
ob_start('ob_gzhandler');
} else {
include (DIR_WS_FUNCTIONS . 'gzip_compression.php');
ob_start();
ob_implicit_flush();
}
} else {
ini_set('zlib.output_compression_level', GZIP_LEVEL);
}
}
Canada Post Package Tracking
Support System
FirePay / Surefire / Optimal Payments
Become a Community Sponsor
MS2.2 Help Documentation
#5
Posted 30 May 2008 - 10:44 AM
Java Roasters, on May 29 2008, 05:50 PM, said:
// if gzip_compression is enabled, start to buffer the output
if ((GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) &&
(PHP_VERSION >= '4')) {
if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {
if (PHP_VERSION >= '4.0.4') {
ob_start('ob_gzhandler');
} else {
include (DIR_WS_FUNCTIONS . 'gzip_compression.php');
ob_start();
ob_implicit_flush();
}
} else {
ini_set('zlib.output_compression_level', GZIP_LEVEL);
}
}Hi, I did mention the option in admin, which controls this bit of code, the point of this tip is to make people aware of this very handy option & how to apply it in admin as well, or any other php pages.
Try it on your admin & see just how much quicker they load.
Remember, What you think I ment may not be what I thought I ment when I said it.
Contributions:
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al.
#6
Posted 04 June 2008 - 04:08 PM
what a difference in speed! great tip!
#7
Posted 05 June 2008 - 08:12 AM
The Coopco Underwear Shop
If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.
#8
Posted 06 June 2008 - 02:56 AM
~Wendy
#9
Posted 07 June 2008 - 03:42 PM
#10
Posted 10 June 2008 - 01:11 AM
#11
Posted 10 June 2008 - 01:51 AM
Just curious - if an old non-supporting browser opens a page with this code in it. what happens? It croaks, or it just passes over it?
#12
Posted 10 June 2008 - 07:02 AM
#13
Posted 10 June 2008 - 06:59 PM
dark_tyrant, on Jun 10 2008, 08:02 AM, said:
Thay wont show any differance, the server will detect the browser does'nt support compression, so will serve uncompressed pages, so the only differance will be the load speed.
Remember, What you think I ment may not be what I thought I ment when I said it.
Contributions:
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al.
#14
Posted 11 June 2008 - 03:02 PM
#16
Posted 17 June 2008 - 08:17 AM
in admin >Configuration >GZip Compression, if i set to "ture" and the level to "3",
can i still add "ob_start("ob_gzhandler");" in catalog/ admin/includes/application_top.php and catalog/incule/application_top.php
i just confuse i have got speed up in admin after add ob_start("ob_gzhandler");" in catalog/ admin/includes/application_top.php.
Anything i have done wrong?
#17
Posted 17 June 2008 - 05:27 PM
quick, on Jun 17 2008, 09:17 AM, said:
in admin >Configuration >GZip Compression, if i set to "ture" and the level to "3",
can i still add "ob_start("ob_gzhandler");" in catalog/ admin/includes/application_top.php and catalog/incule/application_top.php
i just confuse i have got speed up in admin after add ob_start("ob_gzhandler");" in catalog/ admin/includes/application_top.php.
Anything i have done wrong?
If you set to true as above then yes still add to catalog/ admin/includes/application_top.php as that setting has no effect on the admin side, but do not add to catalog/includes/application_top.php as that would generate an error & is not then required anyway.
I hope that makes it clearer.
Remember, What you think I ment may not be what I thought I ment when I said it.
Contributions:
Auto Backup your Database, Easy way
Multi Images with Fancy Pop-ups, Easy way
Products in columns with multi buy etc etc
Disable any Category or Product, Easy way
Secure & Improve your account pages et al.
#18
Posted 19 June 2008 - 03:22 AM
spooks, on Jun 17 2008, 06:27 PM, said:
I hope that makes it clearer.
Thanks Sam very much, your answer make me clear, i did find error when i add to catalog/includes/application_top.php. I really hope i can speed up the client side.
#19
Posted 03 July 2008 - 12:55 PM
#20
Posted 07 July 2008 - 01:50 AM
Can anyone assist me why my website (www.firstalberta.com) is taking too long time to load the first page/time ?
I applied all suggestions as stated above like turn on GZIP and reduce the image size too.
Please let me know how to tune, it is taking nearly 30 to 40 sec's and i need to load the page in 1 sec.
--
Thanks in Advance,
Kart.









