![]() |
|
#1
|
||||
|
||||
Misleading Zlib Configuration Options infoPlease disregard this post, the information is useless - see this post.
At the time of posting, this page at php.net lists the following in their Table 1. Configuration options list: Code:
This is misleading and most likely an error on the page. If you look at this other page, you'll notice that the correct configuration option is listed under Runtime Configuration as: Code:
I had the misfortune of reading the wrong info first and wasted a few hours worth of useless code For anyone wondering what all this means, here's code that you can use at the top of your scripts (or in a global functions.php file) to http://www.desilva.biz/php/zlib.html "compress your PHP-driven web pages" even better than ob_start( ' ob_gzhandler' ) can: PHP Code:
With a little bit more thought you can make this into a sort of a compression switch for each of your scripts (and / or 3rd party scripts)! __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#2
|
||||
|
||||
|
Wow that's cool JDS I searched for ages trying to find the line to insert for the compression level. The php.net help files were really ambigious and I ended up leaving them. Looks really useful. Not sure how a server would perform on level 9 though.
|
|
#3
|
||||
|
||||
|
Quote:
If I were you, I wouldn't worry so much about how the server would perform with max compression - you don't need to, your web host will take care of that for you Seriously? My new sites will use this and it will be at 9 until I find information to the contrary. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#4
|
||||
|
||||
zlib.output_compression != PHP_INI_ALL after all!I was SO wrong, zlib.output_compression cannot be set using ini_set() after all!
It does change the (local) value in your phpinfo() (when ini_set() is used) but the page is NOT compressed! So the only thing one can do is use the .htaccess file adding the following lines to it: Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
||||
|
||||
|
PHP Code:
This is what I have been looking for. I'm going to try it in my .htaccess file. It makes things so much easier than having to try and change the code on my pages. Woo! |
|
#6
|
|||
|
|||
|
I think ini_set() isn't very useful, as most of the ini file options that you actually want to use are already applied before you call ini_set().
For instance, trying to set register_globals to of using ini_set() just doesn't work, as the the PHP predefined variables are already set before the script is even looked at. Similarily with output compression setting, the php.ini's file will set up whatever compression is to be used, before the first line of the script is even looked at. But I suppose it's handy for some settings, like you can change the colours that the syntax_highlight function uses, and other little things too. But nothing major. GF |
|
#7
|
||||
|
||||
|
au contraire, there are many 'useful' uses for ini_set() at least I think they are useful - just not in the case of :
register_globals and zlib.output_compression The reason was I think, because there was initial confusion when many of us looking to manipulate these very same settings found misleading information in the PHP Manual. i.e. for a while back then, the PHP manual stated that register_globals configuration was PHP_INI_ALL when this was clearly not the case. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#8
|
||||
|
||||
|
Isn't there a way to do this in your .htaccess? Maybe I missed t he post about it, I thought I saw it on here tho.
|
|
#9
|
||||
|
||||
|
You can place
Code:
Also its important that you place all your flash files in a seperate folder with php_flag zlib.output_compression off so that it doesn't cause problems since it can't handle it. There is a way to prevent gzip attempting different mime types but I can't find the resource at the moment. Rob |
|
#10
|
|||
|
|||
|
Is there a better way too see if it is compressing the page then just timeing it?
|
Recent GIDBlog
Toyota - 2008 July Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The