PHP compressor

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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?

Thank you!

Re: PHP compressor

Quoted text here. Click to load it

 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

 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 :: :: :: disk and FTP usage analysis tool

Re: PHP compressor

Gale wrote:
Quoted text here. Click to load it

PHP files are parsed by the PHP engine (e.g. Zend) and executed.
Decreasing the physical size of the file will not make it 'faster'.

If you want to minimize the download size of all the server output,
then use a JS and CSS compressor. You can also use ZLib
( ) on the server side to compress the data being

Re: PHP compressor

Thank you both for your answers

Re: PHP compressor

Kimmo Laine wrote:
Quoted text here. Click to load it

Unless next_page.php generates PHP, the script with this include will
only get HTML.

Quoted text here. Click to load it


    if (isset($_GET['foo'])) {
      echo '<?php echo $_GET[\'foo\']; ?>';
    } else {
      echo '<?php echo \'Not available\'; ?>';

File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

Site Timeline