31 December 2008

PHP bcompiler extension

Install necessary prerequisites and PECL extension (replace apt-get with package manager - on suse/fedora use YUM, on gentoo use emerge)

sudo apt-get install php5-dev
sudo apt-get install libbz2-dev
pecl install bcompiler


Add “extension=bcompiler.so” to /etc/php5/apache2/php.ini to activate the extension.

This is how to encode .php files:

<?php
$fh = fopen(“example.phb”, “w”);
bcompiler_write_header($fh);
bcompiler_write_file($fh, “example.php”);
bcompiler_write_footer($fh);
fclose($fh);
?>


Then in your code, update the include to include the .phb file instead.

Installing php eAccelerator

Download and install the latest version of eaccelerator:

wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
tar xjf eaccel*.tar.bz2
cd eaccel*
phpize
./configure
make
make install
cp control.php /var/www/eaccelerator.php

Edit control.php to change the $user and $pw settings.

in your php.ini file, add this:

zend_extension="/usr/lib/php5/20060613+lfs/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/var/cache/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.allowed_admin_path="/var/www/eaccelerator.php"


Create cache directory:

mkdir /var/cache/eaccelerator
chown www-data:www-data /var/cache/eaccelerator
chmod u=rwx,g=rwx,o= /var/cache/eaccelerator

Restart apache:
/etc/init.d/httpd restart

17 December 2008

Flash and other audio players

If you want to get sound to work simultaneously on flash (in firefox) and other video/audio players (like totem), all you need to do is install the "libflashsupport" package and restart firefox - that's it. I'm sooo happy I found this one - helps so much. After all, even gmail uses flash and ties in the audio so no other media player works properly after that ...