Install LZF on php
This is a small tutorial to install lzf on php.
Using download and compile, it should work on every system.
I tested it on kubuntu 12.04.lzf is a very high-speed compression with a reasonable compression ratio. Like zip but faster.
The bigger your text is (more characters),
the better the compression gets.If you want to store the compressed string in a database, make sure it is bitsafe.
e.g. use blob (binary large object).Download the latest version from:
http://pecl.php.net/package/lzf
cd /usr/src/lzf wget http://pecl.php.net/get/LZF-1.6.2.tgz tar xf LZF-1.6.2.tgzNext you need to prepare it for php5 and configure it
Then compile, test and install
cd LZF-1.6.2 phpize ./configure
install need to be done as root, so use sudo
make make test sudo make installTell PHP to load the lsf.so module.
add the following line to /etc/php5/apache2/php.iniProbably best to also add it for cli:extension=lzf.so
/etc/php5/cli/php.iniDon't forget to reload Apache:
Now test your php script with lzf-functions:
sudo /etc/init.d/apache2 reload$ziped_txt=lzf_compress("This is a test of lzf on php; test is done"); print $ziped_txt."\n\n"; print lzf_decompress($ziped_txt)