<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" > <channel><title>Comments on: Compress PHP, CSS, JavaScript(JS) &amp; Optimize website performance.</title> <atom:link href="http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html/feed" rel="self" type="application/rss+xml" /><link>http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html</link> <description>Tutorials, Java, J2EE, Struts, AJAX, JavaScript, CSS, Web 2.0, MySQL, Articles</description> <lastBuildDate>Thu, 09 Feb 2012 07:08:35 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Parvaiz</title><link>http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html/comment-page-2#comment-25867</link> <dc:creator>Parvaiz</dc:creator> <pubDate>Mon, 06 Feb 2012 17:44:48 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=771#comment-25867</guid> <description>i have installed a script on my website for compression on run time,  it works fine but when i check , is it compressed or not i found it is compressed on http://zingro.com/Check-Compression-of-Website.aspx but on other sites i do not find my website is compressed i do not know which is right.</description> <content:encoded><![CDATA[<p>i have installed a script on my website for compression on run time,  it works fine but when i check , is it compressed or not i found it is compressed on <a href="http://zingro.com/Check-Compression-of-Website.aspx" rel="nofollow">http://zingro.com/Check-Compression-of-Website.aspx</a> but on other sites i do not find my website is compressed i do not know which is right.</p> ]]></content:encoded> </item> <item><title>By: Manado</title><link>http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html/comment-page-2#comment-23126</link> <dc:creator>Manado</dc:creator> <pubDate>Sun, 08 Jan 2012 09:59:36 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=771#comment-23126</guid> <description>nice trik. thankyou brother. i will do this on my website</description> <content:encoded><![CDATA[<p>nice trik. thankyou brother. i will do this on my website</p> ]]></content:encoded> </item> <item><title>By: Techie Salsan</title><link>http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html/comment-page-2#comment-16831</link> <dc:creator>Techie Salsan</dc:creator> <pubDate>Tue, 01 Nov 2011 02:03:19 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=771#comment-16831</guid> <description>I am using http://csscompressor.in to compress all of css. Its quick and easy to use online. Just try and see.</description> <content:encoded><![CDATA[<p>I am using <a href="http://csscompressor.in" rel="nofollow">http://csscompressor.in</a> to compress all of css. Its quick and easy to use online. Just try and see.</p> ]]></content:encoded> </item> <item><title>By: Roman</title><link>http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html/comment-page-2#comment-15507</link> <dc:creator>Roman</dc:creator> <pubDate>Fri, 29 Jul 2011 11:58:19 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=771#comment-15507</guid> <description>I compress my CSS only once with my own created css compressor: http://www.igloro.info/en/css_compressor.htmlbut thanks for tut, anways &lt;3</description> <content:encoded><![CDATA[<p>I compress my CSS only once with my own created css compressor:<br /> <a href="http://www.igloro.info/en/css_compressor.html" rel="nofollow">http://www.igloro.info/en/css_compressor.html</a></p><p>but thanks for tut, anways &lt;3</p> ]]></content:encoded> </item> <item><title>By: Tamik</title><link>http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html/comment-page-2#comment-14635</link> <dc:creator>Tamik</dc:creator> <pubDate>Sun, 01 May 2011 19:35:30 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=771#comment-14635</guid> <description>Nice tutorial. But i think doing a compression on server side is a bit overhead on server load. I prefer to compress files once and then just show the compressed  version, the online tool http://www.zbugs.com can help avoid annoying manual compression.</description> <content:encoded><![CDATA[<p>Nice tutorial. But i think doing a compression on server side is a bit overhead on server load. I prefer to compress files once and then just show the compressed  version, the online tool <a href="http://www.zbugs.com" rel="nofollow">http://www.zbugs.com</a> can help avoid annoying manual compression.</p> ]]></content:encoded> </item> <item><title>By: Jasper</title><link>http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html/comment-page-2#comment-14429</link> <dc:creator>Jasper</dc:creator> <pubDate>Sun, 27 Mar 2011 17:31:13 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=771#comment-14429</guid> <description>Oh i forget about the cache part: foreach($files as $file) { $file = $realpath.$file; if ( is_file($file) &amp;&amp; $mtime = filemtime($file)) { $mtimes[] = $mtime; }			} $hash = md5(json_encode($mtimes)); if(!$hash_compare = $this-&gt;cache-&gt;get($hash,false)) { $has_been_modified = true; $this-&gt;cache-&gt;set($hash,Date::YEAR); }</description> <content:encoded><![CDATA[<p>Oh i forget about the cache part:<br /> foreach($files as $file)<br /> {<br /> $file = $realpath.$file;<br /> if ( is_file($file) &amp;&amp; $mtime = filemtime($file))<br /> {<br /> $mtimes[] = $mtime;<br /> }			}<br /> $hash = md5(json_encode($mtimes));<br /> if(!$hash_compare = $this-&gt;cache-&gt;get($hash,false))<br /> {<br /> $has_been_modified = true;<br /> $this-&gt;cache-&gt;set($hash,Date::YEAR);<br /> }</p> ]]></content:encoded> </item> <item><title>By: Jasper</title><link>http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html/comment-page-2#comment-14428</link> <dc:creator>Jasper</dc:creator> <pubDate>Sun, 27 Mar 2011 17:27:20 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=771#comment-14428</guid> <description>You could also minify them in PHP a different way. I do it this way:The user, always gets just the minified version with no checking (or just every week or so) The developer, sets a cookie by logging in as admin, and therefore a filemtime check is done every call, on all the css / js files. If they are expired, the minified version gets rebuilt.. With minified version I mean, all the files combined into one file. Saves about 10 requests in my case :) I then gzip this file too. // write minified file $f = fopen( $outfile , &#039;w&#039; ); if ( $f ) { fwrite( $f, $output ); fclose( $f ); $path = realpath($outfile); $cmd = &quot;gzip -9 $path -c &gt; $path.gz&quot;; shell_exec($cmd); } I combine this with an htacces trick, to get the scripts and styles served Gzipped, STATICALLY :)AddEncoding x-gzip .gz ForceType text/javascript Header set Vary Accept-EncodingAddEncoding x-gzip .gz ForceType text/css Header set Vary Accept-EncodingRewriteCond %{HTTP_USER_AGENT} !&quot;.*Safari.*&quot; RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}.gz -f RewriteRule ^(.*)\.js $1.js.gz [L,QSA]RewriteCond %{HTTP_USER_AGENT} !&quot;.*Safari.*&quot; RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}.gz -f RewriteRule ^(.*)\.css $1.css.gz [L,QSA]This performance difference is another 20-25ms per file, measured on Zend server CE linux, on a core2duo e6300 @ 3ghz.</description> <content:encoded><![CDATA[<p>You could also minify them in PHP a different way.<br /> I do it this way:</p><p>The user, always gets just the minified version with no checking (or just every week or so)<br /> The developer, sets a cookie by logging in as admin, and therefore a filemtime check is done every call, on all the css / js files.<br /> If they are expired, the minified version gets rebuilt..<br /> With minified version I mean, all the files combined into one file. Saves about 10 requests in my case <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br /> I then gzip this file too.<br /> // write minified file<br /> $f = fopen( $outfile , &#8216;w&#8217; );<br /> if ( $f ) {<br /> fwrite( $f, $output );<br /> fclose( $f );<br /> $path = realpath($outfile);<br /> $cmd = &#8220;gzip -9 $path -c &gt; $path.gz&#8221;;<br /> shell_exec($cmd);<br /> }<br /> I combine this with an htacces trick, to get the scripts and styles served Gzipped, STATICALLY <img src='http://viralpatel.net/blogs/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p><p> AddEncoding x-gzip .gz<br /> ForceType text/javascript<br /> Header set Vary Accept-Encoding</p><p> AddEncoding x-gzip .gz<br /> ForceType text/css<br /> Header set Vary Accept-Encoding</p><p>RewriteCond %{HTTP_USER_AGENT} !&#8221;.*Safari.*&#8221;<br /> RewriteCond %{HTTP:Accept-encoding} gzip<br /> RewriteCond %{REQUEST_FILENAME}.gz -f<br /> RewriteRule ^(.*)\.js $1.js.gz [L,QSA]</p><p>RewriteCond %{HTTP_USER_AGENT} !&#8221;.*Safari.*&#8221;<br /> RewriteCond %{HTTP:Accept-encoding} gzip<br /> RewriteCond %{REQUEST_FILENAME}.gz -f<br /> RewriteRule ^(.*)\.css $1.css.gz [L,QSA]</p><p>This performance difference is another 20-25ms per file, measured on Zend server CE linux, on a core2duo e6300 @ 3ghz.</p> ]]></content:encoded> </item> <item><title>By: Maskukuh</title><link>http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html/comment-page-2#comment-14400</link> <dc:creator>Maskukuh</dc:creator> <pubDate>Thu, 24 Mar 2011 00:30:16 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=771#comment-14400</guid> <description>Nice tutorial.. i&#039;ll try this for my web blog.. thanks</description> <content:encoded><![CDATA[<p>Nice tutorial.. i&#8217;ll try this for my web blog.. thanks</p> ]]></content:encoded> </item> <item><title>By: Arn</title><link>http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html/comment-page-2#comment-13933</link> <dc:creator>Arn</dc:creator> <pubDate>Tue, 08 Feb 2011 12:32:23 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=771#comment-13933</guid> <description>Your article served as part of the basis for my newly created offline (batch) script that creates combined, minified and gzipped JS and CSS files. Files are pre-gzipped so no server overhead for compression every time file is served. More info at http://code.google.com/p/compress/</description> <content:encoded><![CDATA[<p>Your article served as part of the basis for my newly created offline (batch) script that creates combined, minified and gzipped JS and CSS files. Files are pre-gzipped so no server overhead for compression every time file is served. More info at <a href="http://code.google.com/p/compress/" rel="nofollow">http://code.google.com/p/compress/</a></p> ]]></content:encoded> </item> <item><title>By: John</title><link>http://viralpatel.net/blogs/2009/02/compress-php-css-js-javascript-optimize-website-performance.html/comment-page-1#comment-13778</link> <dc:creator>John</dc:creator> <pubDate>Fri, 21 Jan 2011 17:42:48 +0000</pubDate> <guid isPermaLink="false">http://viralpatel.net/blogs/?p=771#comment-13778</guid> <description>Thanks for your article. our website loaded quite slow. I hope this will help to speed it up.</description> <content:encoded><![CDATA[<p>Thanks for your article. our website loaded quite slow. I hope this will help to speed it up.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: viralpatel.net @ 2012-02-09 14:14:18 -->
