PHP compressor

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gale

    PHP compressor

    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!
  • Andy Hassall

    #2
    Re: PHP compressor

    On Tue, 22 Aug 2006 00:14:38 +0200, Gale <gale@rules.daw rote:
    >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_com pression in php.ini (amongst other ways).

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

    Comment

    • bobzimuta

      #3
      Re: PHP compressor

      Gale 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?
      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
      (http://us2.php.net/zlib) on the server side to compress the data being
      output.

      Comment

      • Gale

        #4
        Re: PHP compressor

        Thank you both for your answers

        Comment

        • R. Rajesh Jeba Anbiah

          #5
          Re: PHP compressor

          Gale 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?
          Not sure, if you are looking for:
          1. http://www.schroepl.net/projekte/mod_gzip/
          2. http://in2.php.net/ob_gzhandler

          --
          <?php echo 'Just another PHP saint'; ?>
          Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

          Comment

          Working...