This HOWTO is based on SL5, RHEL5, CentOS 5. (rrdtool-1.2.23-1.el5.rf.x86_64, rrdtool-1.2.23-1.el5.rf.i386)
STEP 1 : Go to http://oss.oetiker.ch/rrdtool/pub/contrib/ to get the PHP rrdtool source : php_rrdtool.tar.gz
STEP 2 : Extract the php_rrdtool.tar.gz file into php extensions directory(/usr/include/php/ext/). Please use the following commands :
# tar zxvf php_rrdtool.tar.gz # mv rrdtool /usr/include/php/ext/
STEP 3 : Generate configure files in order to build the PHP rrdtool. In rrdtool directory, run phpize. Please follow the below commands:
# cd /usr/include/php/ext/rrdtool # phpize # ./configure --with-php-config=/usr/bin/php-config --with-rrdtool=/usr
Notes : Make sure you have librrd.so file in library. If you don’t have that file, you can do a symbol link as bellow :
# ln -s /usr/lib/librrd.so.2 /usr/lib/librrd.so
STEP 4 : Build the PHP rrdtool. Just use make and make install commands.
# make
/bin/sh /usr/include/php/ext/rrdtool/libtool --mode=install cp ./rrdtool.la /usr/include/php/ext/rrdtool/modules
cp ./.libs/rrdtool.so /usr/include/php/ext/rrdtool/modules/rrdtool.so
cp ./.libs/rrdtool.lai /usr/include/php/ext/rrdtool/modules/rrdtool.la
PATH="$PATH:/sbin" ldconfig -n /usr/include/php/ext/rrdtool/modules
----------------------------------------------------------------------
Libraries have been installed in:
/usr/include/php/ext/rrdtool/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
# make install
Installing shared extensions: /usr/lib64/php/modules/
STEP 5 : Configure rrdtool.so in php configuration file.
# cd /etc/php.d/ # vi rrdtool.ini ; Enable rrdtool extension module extension=rrdtool.so
STEP 6 : Restart apache web services.
# service httpd restart
After compiling and installing rrdtool you should be able to use the phpinfo() function to list the installed extensions.
You should see rrdtool in phpinfo page.


July 13th, 2009 at 11:30 pm
hello,
I’m working on ubuntu 8.10 and I want to create the rrdtool.so file but when I type
“./configure –with-php-config=/usr/bin/php-config –with-rrdtool=/usr”
it’s not working, it says:
checking if rrdtool specified path is valid… no
configure: error: The specified RRDTool path is Invalid or the installation is incomplete
Please specify another path or reinstall the rrdtool distribution
would you tell me how to fixe this or what are those files ??
thanx
July 14th, 2009 at 9:44 am
hi pierre,
did you install rrdtool in your ubuntu? you have to install rrdtool, first. i use scientific linux. so, i don’t know how to install rrdtool on ubuntu.
after you installed rrdtool. just locate the rrdtool.so. configure with “with-rrdtool=/SOMEWHERE”.
best, s
October 10th, 2009 at 5:01 am
here are the commands that i’v used to compile and install on ubuntu 8.04.1 and 9.04 (both versions work fine)
apt-get install librrd2-dev php5-dev
wget http://oss.oetiker.ch/rrdtool/pub/contrib/php_rrdtool.tar.gz
tar zxvf php_rrdtool.tar.gz
mv rrdtool /usr/include/php5/ext
cd /usr/include/php5/ext/rrdtool
phpize
./configure –with-php-config=/usr/bin/php-config –with-rrdtool=/usr
ln -s /usr/lib/librrd.so.2 /usr/lib/librrd.so (if file exists ignore)
make
make install
cd /etc/php5/conf.d/
pico rrdtool.ini
paste the following
;enable rrdtool extension module
extension=rrdtool.so
save and exit pico
/etc/init.d/apache2 restart
December 16th, 2009 at 4:37 am
Thanks to your help I managed to install the darn thing. Along with the phpinfo() command it is also useful to run “php –ini” as this told me the “make install” was installing in the wrong place.
/usr/lib/php # php –ini
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/extensions/rrdtool.so’ – /usr/lib/php5/extensions/rrdtool.so: cannot open shared object file: No such file or directory in Unknown on line 0
May 30th, 2010 at 10:59 pm
thanks Sam for the instructions,
I followed instructions for Ubuntu as Miguel mentioned in his comment and everything is great.
June 13th, 2010 at 7:34 pm
If you get an error about rrdtool wrong path, then probably you will need to install the rrdtool development package:
On Ubuntu (or Debian): apt-get install rrdlib-dev
On Centos (or Redhat): yum install rrdtool-devel
best regards
June 14th, 2010 at 10:00 pm
thanks isogashii & Miguel for the great information. : )