What is eAccelerator?
eAccelerator is a PHP speed-up tool. PHP is the language many websites use. Each time a visitor loads a page, PHP reads and turns the code into steps. This takes time. eAccelerator saves those steps in memory. The next visit is faster. It is like keeping a finished recipe card instead of reading the cookbook every time.
Warning: A wrong change can break every site on the server. Take a full backup first.
Before you start
- Log in over SSH as root.
- Make sure the build tools exist.
This installs the tools needed to build PHP add-ons.yum install -y gcc make autoconf php-devel - Check your PHP version with
php -v.
Steps
- Go to a working folder.
cd /usr/local/src - Download the eAccelerator source package that matches your PHP version, from its project page. Save it in this folder.
- Unpack it. Change the file name to match yours.
This opens the package.tar xjf eaccelerator-0.9.6.tar.bz2 cd eaccelerator-0.9.6 - Prepare the build.
This sets up the files for your PHP version.phpize - Configure and build.
These commands compile the add-on and place it in PHP's folder../configure --enable-eaccelerator=shared make make install - Make a cache folder.
The add-on stores its files here.mkdir /tmp/eaccelerator chmod 777 /tmp/eaccelerator - Add settings to your
php.inifile. Find it withphp --ini.
The first line loads the add-on. The size is in megabytes.extension="eaccelerator.so" eaccelerator.shm_size="64" eaccelerator.cache_dir="/tmp/eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" - Restart Apache.
This reloads PHP with the new add-on.service httpd restart - Check it.
The output should mention eAccelerator.php -v
On a server with WHM
cPanel servers often use EasyApache to build PHP. The older EasyApache 3 allowed eAccelerator as an option. If you use EasyApache, pick it there, rather than build by hand. Ask Hostvento support if you are not sure which fits your server.
Quick recap
- eAccelerator speeds up PHP by caching compiled code.
- It is old. Use OPcache with modern PHP.
- Build it with
phpize,configure,make, then editphp.ini. - Restart Apache and check with
php -v.