Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 2
Improve Site Speed Performance (Alpha Release)
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 

I wonder if this is a PHP issue that running in CGI mode or something daft?

We use Plesk for all our solutions, but i would not think it would be any different to Cpanel :/

 
Magento Community Magento Community
Magento Community
Magento Community
 
aquiss
Member
 
Total Posts:  54
Joined:  2008-05-03
United Kingdom
 
Discovery - 01 December 2008 02:53 AM

Is it possible to serve up a pre-gzipped css file? What happens if one just gzips the file and loads a styles.css.gz - is that doable?

That’s kinda what i am trying to avoid for the majority of people...ie: something simple

In theory Step 5 should be working, well going by all the docs I’ve read this morning it should :/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

Compressing a file is one thing, removing comments and white space is something else. For the ultimate in small css the following is of note:

http://www.cssdrive.com/index.php/main/csscompressoradvanced/

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

I’d been so busy that I completely neglected to follow this up.

I think it’s a server issue. Hostgator support helped setup a php.ini for me and suggested that I use php.ini instead of .htaccess. However it was still not working as the server was complaining a gzip.php was missing. I just got another answer that they do not offer mod_gzip or mod_deflate in Apache but willing to take a look of my setup to help figure out the problem.

Will report back if I get any progress.

 
Magento Community Magento Community
Magento Community
Magento Community
 
breen
Jr. Member
 
Total Posts:  3
Joined:  2008-03-16
London, UK.
 

I’ve used aquiss’ s two files. They didn’t work at first but I made “.htaccess” a “php.ini” file and it works fine.

The php.ini is as follows…

[PHP]

AddHandler application/x-httpd-php5 .css
php_value auto_prepend_file gzip-css.php

It seems to improve the site’s performance, especially image loading. Have a look at… http://www.ciaranbreen.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
vadimc
Sr. Member
 
Avatar
Total Posts:  87
Joined:  2008-10-25
London
 
aquiss - 01 December 2008 01:02 AM

4) Enabling Gzipping (Part 1)

Find the .htaccess file located in the root of your store to enable HTML compressing.

Find

# php_flag zlib.output_compression on

Change to
php_flag zlib.output_compression on


5) Enabling Gzipping (Part 2)

Introduce a new Apache AddHandler to compress CSS files on the fly. I came across this technique eleswhere on the Internet, but my site pages are now flying as a result.

- Create a file called “gzip-css.php” and add/save the following into it:
<?php
ob_start 
("ob_gzhandler");
header("Content-type: text/css; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset 60 60 ;
$ExpStr "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";
header($ExpStr);
?>


- Create a file called “.htaccess” and add/save the following into it:
AddHandler application/x-httpd-php .css
php_value auto_prepend_file gzip
-css.php

- Locate your template CSS directory and upload both files that you created to it.
cd skin/frontend/default/YOUR_TEMPLATE/css/

I did all the above, but the css is breaking a bit.
when i change the AddHandler application/x-httpd-php .css to AddHandler application/x-httpd-php5 .css its working fine.

but then again, how to i tell if the above changes make a difference? is there any way to test this?

[url=http://www.exquisitewine.co.uk]http://www.exquisitewine.co.uk[/url]

And if this is indeed working, can something like that be done for the js? i have jquery running alongside the prototype and together they make about 250kb (this is what firebug in firefox is telling me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

To replace your #5, I used this in the virtual host for the site:

# Turn on Expires and set default to 0
                ExpiresActive On
                ExpiresDefault A0

                
# Set up caching on media files for 1 year (forever?)
                
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
                        
ExpiresDefault A29030400
                        Header append Cache
-Control "public"
                
</FilesMatch>

                
# Set up caching on media files for 2 weeks
                
<FilesMatch "\.(gif|jpg|jpeg|png|swf)$">
                        
ExpiresDefault A1209600
                        Header append Cache
-Control "public"
                
</FilesMatch>

                
# Set up 1 week caching on commonly updated files
                
<FilesMatch "\.(xml|txt|html|js|css)$">
                        
ExpiresDefault A604800
                        Header append Cache
-Control "proxy-revalidate"
                
</FilesMatch>

                
# Force no caching for dynamic files
                
<FilesMatch "\.(php|cgi|pl|htm)$">
                        
ExpiresActive Off
                        Header set Cache
-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
                        
Header set Pragma "no-cache"
                
</FilesMatch>

No need to piss about with php files specifically for css. Do everything in one fell swoop.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Fastmover
Jr. Member
 
Avatar
Total Posts:  6
Joined:  2009-10-22
Kansas City, Mo
 

3) MySQL Cache Size

Configure or ask your hosting company to switch on or tweak to ensure you have enough mysql cache. I have found the following to be a good reasonable size:
- query_cache_size=64M

This worked great, sped up my loading time on magento by a couple seconds.

 
Magento Community Magento Community
Magento Community
Magento Community
 
matchattaxdirect
Jr. Member
 
Total Posts:  3
Joined:  2010-09-08
 
J.T. - 25 March 2009 08:46 AM

To replace your #5, I used this in the virtual host for the site:

# Turn on Expires and set default to 0
                ExpiresActive On
                ExpiresDefault A0

                
# Set up caching on media files for 1 year (forever?)
                
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
                        
ExpiresDefault A29030400
                        Header append Cache
-Control "public"
                
</FilesMatch>

                
# Set up caching on media files for 2 weeks
                
<FilesMatch "\.(gif|jpg|jpeg|png|swf)$">
                        
ExpiresDefault A1209600
                        Header append Cache
-Control "public"
                
</FilesMatch>

                
# Set up 1 week caching on commonly updated files
                
<FilesMatch "\.(xml|txt|html|js|css)$">
                        
ExpiresDefault A604800
                        Header append Cache
-Control "proxy-revalidate"
                
</FilesMatch>

                
# Force no caching for dynamic files
                
<FilesMatch "\.(php|cgi|pl|htm)$">
                        
ExpiresActive Off
                        Header set Cache
-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
                        
Header set Pragma "no-cache"
                
</FilesMatch>

No need to piss about with php files specifically for css. Do everything in one fell swoop.

I am using a VPS and would like to optimise Magento - where exactly do you put this stuff?  My VPS uses Plesk containers.

Cheers,

 
Magento Community Magento Community
Magento Community
Magento Community
 
matchattaxdirect
Jr. Member
 
Total Posts:  3
Joined:  2010-09-08
 
aquiss - 01 December 2008 01:02 AM

4) Enabling Gzipping (Part 1)

- Create a file called “gzip-css.php” and add/save the following into it:

<?php
ob_start 
("ob_gzhandler");
header("Content-type: text/css; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset 60 60 ;
$ExpStr "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";
header($ExpStr);
?>


- Create a file called “.htaccess” and add/save the following into it:
AddHandler application/x-httpd-php .css
php_value auto_prepend_file gzip
-css.php

- Locate your template CSS directory and upload both files that you created to it.
cd skin/frontend/default/YOUR_TEMPLATE/css/

Doing this has broken any httpS pages used on my site - it strips out all css.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Borduhh
Member
 
Avatar
Total Posts:  40
Joined:  2010-09-14
Rochester, NY
 
aquiss - 30 November 2008 08:29 AM

Like many, i’m looking for ways to make my site run faster as load times can be a little poor at times, which shamefully lets a great product down. Therefore I am trying to get a collective thread together (rather than dozens of posts) to see if we can all work on ways to help each other. As ideas come forward, and prove useable, I will add them here for quick reference for all.

The following ideas I have deployed, which seem to have helped me a great deal.

1) Magento Caching.

Goto Magento Admin -> System -> Cache Management
- Tick the following items:
-- Configuration
-- Layouts
-- Block HTML output
-- Translations

-Untick the following items: (if ticked they seem to have a negative impact atm)
-- Collections Data
-- EAV types and attributes
-- Web Services Configuration

I am running Magento 1.4.1. Does this still apply or has this been fixed?

Best Regards,
Nick

 
Magento Community Magento Community
Magento Community
Magento Community
 
CustomHT
Jr. Member
 
Total Posts:  20
Joined:  2010-01-30
 
J.T. - 25 March 2009 08:46 AM

To replace your #5, I used this in the virtual host for the site:

# Turn on Expires and set default to 0
                ExpiresActive On
                ExpiresDefault A0

                
# Set up caching on media files for 1 year (forever?)
                
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
                        
ExpiresDefault A29030400
                        Header append Cache
-Control "public"
                
</FilesMatch>

                
# Set up caching on media files for 2 weeks
                
<FilesMatch "\.(gif|jpg|jpeg|png|swf)$">
                        
ExpiresDefault A1209600
                        Header append Cache
-Control "public"
                
</FilesMatch>

                
# Set up 1 week caching on commonly updated files
                
<FilesMatch "\.(xml|txt|html|js|css)$">
                        
ExpiresDefault A604800
                        Header append Cache
-Control "proxy-revalidate"
                
</FilesMatch>

                
# Force no caching for dynamic files
                
<FilesMatch "\.(php|cgi|pl|htm)$">
                        
ExpiresActive Off
                        Header set Cache
-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
                        
Header set Pragma "no-cache"
                
</FilesMatch>

No need to piss about with php files specifically for css. Do everything in one fell swoop.

I know this is an old post, But I have to give you a big shoutout.

Thanks to these few lines of .htaccess code my site google page speed scores went from 56 to 67 (still a long way to go i know).
Also shaving about 20% off my page load times.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Magazento
Sr. Member
 
Avatar
Total Posts:  155
Joined:  2010-01-08
Russia,Volgograd
 

read this: http://www.magentocommerce.com/whitepaper/

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2