Gzip compression? (General)

by Andrew M., Thursday, March 05, 2009, 16:55 (5502 days ago)

Hi,

I am pretty new to mlf 2.* and I have been working all my way through the documentation now, still I have not found info on Gzip compression. Whether this is used by mylittleforum or, if not or just recommended, how to implement it.

Thanks!

Andrew

Gzip compression?

by Auge, Thursday, March 05, 2009, 17:39 (5502 days ago) @ Andrew M.

Hello

I am pretty new to mlf 2.* and I have been working all my way through the documentation now, still I have not found info on Gzip compression. Whether this is used by mylittleforum or, if not or just recommended, how to implement it.

Isn't this a server issue? Elsewhere the script has look for the "Accept-Encoding" Header, which is transmitted by the browser (or not) to decide if it has to compress the output or not. But in my opinion this is servers business.

Tschö, Auge

Thanks!

by Andrew M., Friday, March 06, 2009, 09:27 (5501 days ago) @ Auge

Hi Auge,

a friend of mine has worked with 1.7.* and told me once there is would be a Gzip code in 'inc.php' that lowers web traffic by 50 percent. I am using 2.0.2 since a couple of days and thought if his info is true, this would be part of documentation. It was not, though I wanted to ask about it here.

Thanks

Andrew M.

Thanks!

by Auge, Friday, March 06, 2009, 12:04 (5501 days ago) @ Andrew M.

Hello

a friend of mine has worked with 1.7.* and told me once there is would be a Gzip code in 'inc.php' that lowers web traffic by 50 percent.

I searched in my copy of mlf 1.7.6. No, this file contains no gzip functionality.

I am using 2.0.2 since a couple of days and thought if his info is true, this would be part of documentation. It was not, though I wanted to ask about it here.

As a possible solution I suggest to ask your hoster if gzip compression is activated or if it is possible to activate it on the webserver.

Tschö, Auge

Avatar

gzip fine with me...

by Alfie ⌂, Vienna, Austria, Friday, March 06, 2009, 17:51 (5501 days ago) @ Andrew M.
edited by Alfie, Saturday, March 07, 2009, 11:25

Hi Andrew!

As Auge already pointed out, gzip is a server's issue. I'm running it on my forum's installation (1.7.6) since last May and it reduced traffic to about 15-20%.
I hope you may place a .htaccess file in the document root. Example:

# compress all variants of plain text
<FilesMatch ".(php|html|htm|css|js|txt)$"> 
  SetOutputFilter DEFLATE
</FilesMatch>

That's all you have to do (no modification of scripts) if gzip is supported by your hoster.
To check, open a new text file with following content:

<?php
  echo 'PHP info: ' . phpinfo();
?>

Save it as e.g. foo.php, upload it to your webspace, and call it through your browser.
Assuming an Apache webserver, look for Apache Environment. If the table contains a row
HTTP_ACCEPT_ENCODING | gzip, deflate
you are a winner.
Other places to look for are
Section HTTP Headers Information
Subsection HTTP Request Headers
Accept-Encoding | gzip, deflate
Subsection HTTP Response Headers
Content-Encoding | gzip
Section PHP Variables
_SERVER["HTTP_ACCEPT_ENCODING"] | gzip, deflate

Afterwards delete foo.php from your server (it may be a security issue).

If gzip is not supported, talk to your provider or modify the scripts...

Don't try to compress graphics (png, jpg, gif), since they are already compressed and any attempt doing so may reduce the traffic just a little at the cost of a lot of server's resources.

--
Cheers,
Alfie (Helmut Schütz)
BEBA-Forum (v1.8β)

Winning notification

by Andrew M., Saturday, March 07, 2009, 13:43 (5500 days ago) @ Alfie

According to your foo.php I am a winner ..........!

Thanks!

Andrew M.

Avatar

Winning notification

by Alfie ⌂, Vienna, Austria, Sunday, March 08, 2009, 00:29 (5500 days ago) @ Andrew M.

According to your foo.php I am a winner ..........!

Congratulations! :-D

--
Cheers,
Alfie (Helmut Schütz)
BEBA-Forum (v1.8β)

gzip followup

by abe froman ⌂ @, Monday, March 30, 2009, 04:14 (5478 days ago) @ Alfie

is that only valid on apache2? I'm getting a 500 when I try to add that however i have verified that it is enabled in my phpinfo :-(

gzip followup

by Auge, Monday, March 30, 2009, 12:55 (5477 days ago) @ abe froman

is that only valid on apache2?

No. For Apache 1 it should give a module too.

I'm getting a 500 when I try to add that however i have verified that it is enabled in my phpinfo :-(

Alfie talked about gzip compression wich is made by the server. Therefore there has to be installed the according server module. In doubt ask your hoster.

In contrast the PHP module for gzip gives you the ability to gzip any files via a PHP script.

Tschö, Auge

Registration, more info from user

by Andrew M., Friday, March 06, 2009, 09:51 (5501 days ago) @ Andrew M.

Another issue: I am actually working on making a few optional info (like location etc.) non-optional and well part of the registration. I have added some code to register.inc.php and register.tpl.inc already. Unfortunately the values typed into these new blanks there are then not stored in the database in the process.

So this is just a (minor?) storage issue and I think this to achieve is down to register.inc.php. I would be glad if there is anyone telling me which code to add there to make that work.

Thanks!

Andrew M.

Registration, more info from user

by Auge, Friday, March 06, 2009, 12:09 (5501 days ago) @ Andrew M.

Hello

Another issue: I am actually working on making a few optional info (like location etc.) non-optional and well part of the registration. I have added some code to register.inc.php and register.tpl.inc already. Unfortunately the values typed into these new blanks there are then not stored in the database in the process.

Did you enhance the database itself (needs new fields?) and the MySQL query/queries for INSERT/UPDATE of this table? And another one: You may expand not only the form and query for the registration process, the user should be able to alter the details later (maybe long time afer registration).

Tschö, Auge

Registration, issue

by Andrew M., Friday, March 06, 2009, 15:07 (5501 days ago) @ Auge

Did you enhance the database itself (needs new fields?) and the MySQL query/queries for INSERT/UPDATE of this table? And another one: You may expand not only the form and query for the registration process, the user should be able to alter the details later (maybe long time afer registration).

It does not work properly with all the things now (especially the fields with digits remain an issue). Of course, the user is able to alter details afterwards. The database not requires new fields, just about everything the User can manually edit himself later on should be typed in by him also in the initial registration process.

Would be great if there is an idea how to store the users birthday straight away. I fear I just need to submit a code snippet into the mysql_query on line 131 of register.inc.php. Just $user_birthday does not fix it.

Thanks!

Andrew

RSS Feed of thread