In a previous article on op-code cache benchmarking, we briefly mentioned instructions on installing eAccelerator from source.
We now expand these instructions a bit to update that for installing on Ubuntu Feisty 7.04.
First, download eAccelerator 0.9.5.1 from the project's web site. Note that 0.9.5.1 has a patch for PHP 5.2.x which Ubuntu Feisty installs by default.
Extract the archive
Extract the archive
tar xjvf eaccelerator-0.9.5.1.tar.bz2
Configure for your PHP
Change to the directory you extracted
Then run phpize
Then run configure
Next, run make to build the binaries.
You install by running the command:
The shared object for eacclerator will be copied to where PHP can find it.
Starting with Feisty, Ubuntu has a new way of configuring PHP components. Instead of having all the configuration directives in a single php.ini, there is a directory called conf.d that has under it a file for each component. So, under /etc/php5/conf.d you would create a new file called eacclerator.ini and put the following in it:
Adjust your paths depending on what you want to use.
zend_extension = "/usr/lib/php5/20060613+lfs/eaccelerator.so"
eaccelerator.shm_size = "0"
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 = "7"
eaccelerator.allowed_admin_path = "/var/www/eaccelerator"
Now create a simple file, say phpinfo.php and put in it the following:
<?php phpinfo() ?>
Point your browser to the file you just created, and verify that eAccelerator is enabled.
Enable eAccelerator's control panel
You can copy the file control.php that is provided with eAccelerator to some secure location, change the account and password in it and use it to see what eAccelerator is doing. For example, it will give you a list of scripts that are used, how many times they were accessed, shared memory usage, and more.
Enjoy the speed!