RRDTool PHP plugin.

More on rrdtool

A continuation of Part 1 RRDTOOL with LIBART

Updated 2015 April 2. Using php 5.4.x and php 5.5.x and greater.

Now that the rrdtool version 1.2.30 with libart is working.
I want to use the php-rrdtool plugin that work with the 1.2.30 rrdtool version.
The only php rrd plugin that works is the plugin from the rrdtool website.
http://oss.oetiker.ch/rrdtool/pub/contrib/php_rrdtool.tar.gz
The plugins for rrdtool found at php pecl only work for the newer versions of rrdtool.

Installing it:

# cd /usr/include/php/ext
# wget http://oss.oetiker.ch/rrdtool/pub/contrib/php_rrdtool.tar.gz
# tar -xvf php_rrdtool.tar.gz
# cd rrd-tool
# phpize
# ./configure
# make
# make install

Last line of compile output is:
Installing shared extensions: /usr/lib/no-debug-non-zts-20131226/
(the date stamp varies depending on php version)

Changes to /etc/php.ini
Add or change the extensions-dir
extension_dir = “/usr/lib/no-debug-non-zts-20131226/”
Append below the extensions block
extension=rrdtool.so

Restart the httpd server so that php applies the changes.
Done !

However this only works for PHP versions 5.3.x and lower.
For PHP versions 5.4.x and greater the plugin fails to compile due to changes in php.
Some details about the php changes can be found here
Which has a link to a patch.
Good news and bad new. The patch didn’t quite work for me for reasons unknown. Maybe fedora uses a slight different/modified version. However I was able to fix the patch and it works !

** Update.
PHP version 5.5.x and greater breaks the plugin again.
I have updated the patch that fixes this. Use it when using php 5.4.x and greater.

Download my version of the patch for PHP 5.4.x or greater

Installing it with patch:

# cd /usr/include/php/ext
# wget http://oss.oetiker.ch/rrdtool/pub/contrib/php_rrdtool.tar.gz
# wget http://www.shrike.tk/files/rrdtool-php55.patch
# tar -xvf php_rrdtool.tar.gz
# cd rrd-tool
# patch -Np1 -i ../rrdtool-php55.patch
# phpize
# ./configure
# make
# make install

Happy php graphing 🙂

Leave a Reply

Your email address will not be published.

+ 57 = 60