Configuring Ubuntu – Part 2

Opps. I just checked a few of my older blog posts and quickly realized I neglected to post part 2 of my ‘Configuring Ubuntu – Part 1’ guide.

Well, here it is!

By default, Ubuntu Server installs MySQL and PHP. However, it doesn’t tweak the system for performance. If you run a WordPress blog on your server, you may not realize that your blog could run more efficiently. WordPress relies on both PHP and MySQL. PHP scripts need to be read from a server’s hard drive, parsed by the web server software and then executed. Wouldn’t it be nice if the server could just skip the first two steps and just execute PHP scripts as quickly as plain HTML?

That’s where eAccelerator comes in. eAccelerator is a free, open-source PHP accelerator and cache. I’ve been using it for nearly seven years on personal and commercial servers. In other words, it’s very stable for a free product.

Let’s get started.

First of all, you need to ensure that you have the php5-dev package installed on your server. It’s likely not installed, so let’s install it:

you@yourserver:~$ sudo apt-get install php5-dev

Next, download the latest build and extract it:

you@yourserver:~$ wget
you@yourserver:~$ tar -xvjf eaccelerator-
you@yourserver:~$ cd eaccelerator-

Time to compile eAcccelerator:

you@yourserver:~$ sudo find / -name phpize
you@yourserver:~$ export PHP_PREFIX=”/usr/bin”
you@yourserver:~$ $PHP_PREFIX/phpize
you@yourserver:~$ ./configure –enable-eaccelerator=shared –with-php-config=$PHP_PREFIX/php-config
you@yourserver:~$ sudo apt-get install make
you@yourserver:~$ make

That was a mouthful, eh? Next, we need to install the eAccelerator module we just created:

you@yourserver:~$ cd modules
you@yourserver:~$ sudo cp /usr/lib/php5/20051025/

Edit your php.ini and paste the following block into it after the extensions block:


Almost done. Create /tmp/eaccelerator:

you@yourserver:~$ mkdir /tmp/eaccelerator
you@yourserver:~$ chmod 777 /tmp/eaccelerator

One more step! We need to restart Apache for the changes to take effect:

you@yourserver:~$ sudo /etc/init.d/apache2 restart

There you have it. Your PHP-based scripts and applications should run nearly 70% faster!

Leave a Reply

Your email address will not be published. Required fields are marked *