Monday, December 14, 2015

Vastly improve Observium performance with PHP 7

This is a quick guide on how to install PHP 7 in Ubuntu and have it work with Observium to greatly speed things up. Note that this will only be useful if you have a very large Observium-installation and start to notice the web interface slowing down.

PHP 7.0.0 released a couple of weeks ago and promised up to double the performance of PHP 5.
As I run a very large Observium installation with over 1100 devices that are being monitored I had a very slow web interface as a result of that. When I heard about the big performance improvements in PHP7 I decided to try it out.

The result was even better than I expected! Most of the pages in the web UI needed about 5s to render and some even needed over 7s with PHP5. After switching to PHP7 my UI now loads most pages in less than 1.5s and the most heavy pages renders in about 2s.
PHP7 proved to perform 2 to 3 times as fast as PHP5!

Install Observium with PHP 7

To install Observium with PHP7 you need to change a few step from the install guide.
Note that this only works for Observium Pro for now, Observium CE wont work with PHP7 yet!

This is based on the Ubuntu 14-guide and assumes you have a freshly installed Ubuntu 14.
First we need to add the repository for PHP7:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php-7.0
 The update and install php7
sudo apt-get update
sudo apt-get install php7.0 php7.0-mysql php7.0-mcrypt libapache2-mod-php7.0
And lastly we install the rest of the required observium packages
sudo apt-get install php-pear snmp fping mysql-server mysql-client python-mysqldb rrdtool subversion whois mtr-tiny ipmitool graphviz imagemagick
now we can continue to follow the guide for Observium Pro. The only important thing to look for is that you make sure your config.php contains this option:
$config['db_extension'] = 'mysqli';
before you try to run the update.php-script.

When the installation is complete you can visit the About Observium-page and you will se that Observim runs on PHP7

My Observium is polling slowly, will PHP7 help me?

no, polling is almost only dependent on disk IO and the SNMP response speed of the device you poll, PHP7 will do very little difference to the pollingtime.

Does Observium CE work with PHP7?

no, the current CE does not support PHP7, you need to have Pro.

Is Observium fully compatible with PHP7?

I have tried to test as many of the features in Observium that I could, and so far everything seems to work just fine. I have not tried the billing-module however.
Always try this in a test-install first, as there may be some features that are not fully compatible.


  1. So you did a clean install for this or did you do an in place upgrade of php? Any problems with the weathermap integration afterwards?

  2. Hello, I did a clean install to test this guide but I also made an upgrade on my production machine from php5 to php7. I will not try to make a guide for that though as to many things can break, I recommend that you know what you are doing before you try but its not very hard to do an upgrade either, just replace the the php5 packages you have with the php7-ones from the guide above.
    Weathermap-addon still works fine, but you will need the php7.0-gd package also and maybe some other packages as well...
    Feel free to try it but don't blame me if your install should break :)

    1. I had upgraded to php7 probably around the time I left these comments, and indeed was pretty painless, however at the time noticed that the data-pick for device lists when creating new weathermaps no longer worked. Related to the move away from mysql_ and now requiring mysqli_ in php7. You should add a note :)

  3. I installed Observium using the instructions at

    Is it safe to upgrade to PHP7?