[...] go using output buffering while utilizing our zlib.output_compression method mentioned in “PHP compression without ob_start“. (Strangely, that article was for not using ob_start, while this article is about using [...]
Great article, finally got gzip working using the php.ini file. However, I was wondering how I should gzip other files such as html and css. I guess i could just use php and change the headers to .js, .css, or .html. What do you think?
Here’s how I do it on some of my web sites:
I use .htaccess to send JS, CSS, and HTML through PHP:
AddType application/x-httpd-php .js
Then, making sure that ALL of my JavaScript files are in a folder by themselves (or that the folder only contains JS files), I would create a php.ini file in that directory containing the customizations noted above in the article, and with the following additional line:
auto_prepend_file /home/yourusername/public_html/php.includes/js.inc.php
The js.inc.php file SIMPLY does the purpose of sending the appropriate header.
You’ve given me an excellent idea for a future article. Check back tomorrow. I may also include tips on using browser caching in the js.inc.php file to reduce bandwidth even further.
[...] Firefox, JavaScript, PHP, toolbar, zlibToday, a newly-registered user “jcapshaw” noted (on an older blog post about using zlib for output compression in PHP) that he wanted to send [...]
Names and email addresses are required (email addresses aren't displayed), url's are optional.
Comments may contain the following xhtml tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Comments by unregistered users need approval, and all comments are subject to Akismet SPAM filtering. A valid e-mail address is required but will not be published or used for third-party solicitation (see our Privacy Policy). Please provide either your real name or a nickname representative of yourself.