Install LZF on php (Gentoo)
This is a small tutorial to install lzf on php.
For a general install with tarball and make go herelzf 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).This is specific for a installation on Gentoo linux.
Other linux flavors should use there own package managers.You need to install dev-php/pecl-lzf
it is specified for php5.3I needed to addUSE="" PHP_TARGETS="php5-3" emerge -q dev-php/pecl-lzf
to /etc/portage/package.accept_keywords else it wouldn't compile.=dev-php/pecl-lzf-1.6.2 ~amd64
Make sure you use php5.3 for Apache or CLI.
Do this with the following:You don't have to set cli and apache to the same php-version, (you can even set a different php-version for different websites) But it makes troubleshooting a lot easier.
eselect php list cli [1] php5.3 [2] php5.4 * eselect php set cli 1 eselect php set apache2 1Don't forget to restart Apache:
Now test your php script with lzf-functions:/etc/init.d/apache2 restart
$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)