Reply to Re: PHP compressor

Your name:

Reply:


Posted by Andy Hassall on 08/21/06 22:29

On Tue, 22 Aug 2006 00:14:38 +0200, Gale <gale@rules.da> wrote:

>I'm looking for PHP code for compressing another PHP code.
>Is there any solutions for free download?
>
>It would be good if it can compress JS and CSS too.
>
>Would there be significant speed improvement by compresing an PHP script?

Compressing a PHP script would more likely slow things down, since it'd just
have to be decompressed by the server again. If you want to speed up PHP,
you'll get better results from a bytecode cache, such as APC, or the Zend
product.

If by compression you mean simply removing any redundant whitespace and
comments, I would expect very tiny gains in performance; nothing like what
you'd get from a bytecode compiler (which effectively does that, and
considerably more).

Compressing JS and CSS is potentially a different matter; you can get some
gains there because you reduce the amount of data sent over the network to the
client. Depends where the bottleneck is; for small files over a fast network it
won't help. You're probably best off getting your webserver to do this for you;
for Apache, see mod_deflate.

In a similar way you can also get PHP to compress the _output_ of the script,
by setting zlib.output_compression in php.ini (amongst other ways).

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация