[rrd-users] this is wat I have done to work with rrdtool in PHP. can u help me

Thati Ravi thati.ravi at gmail.com
Thu Jun 8 09:25:58 MEST 2006


I have tried these things  today morning *****  ( and in the previous mail I
have supplied my OS an d all the required details any way specifying again
 OS: Fedora Core2  Apache2.2.2 and  PHP 4/5 both with explanation show here)
1.First I have installed rrdtool1.0.49 with source code downloaded frm
rrdtool website again
2.Got the php4rrdtool1.03 and configured it php4/5 as shown in below
explanation.
1.About RRDTool1.0.49:

RRDTool-1.0.49:
 ./configure --enable-shared
make
make install

Then
2.php4rrdtool1.03
 PHP4RRDTool1.03\

1.Untarred into a directory
2.rrdmodule$./configure --with-rrdtool=/path/to/rrdtool-1.0.49/
--with-php-config=/path/to/php-config
(Here I have two PHP versions php4 and php5.1.2)

First with php5's php-config file:
 OutPut of configure comand:
./configure --with-rrdtool=/usr/local/rrdtool-1.0.49/
--with-php-config=/usr/local/bin/php-config
loading cache ./config.cache
checking for gcc... (cached) gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking whether gcc and cc understand -c and -o together... (cached) yes
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php
-I/usr/local/include/php/main -I/usr/local/include/php/TSRM
-I/usr/local/include/php/Zend -I/usr/local/include/php/ext
checking for PHP extension directory...
/usr/local/lib/php/extensions/no-debug-non-zts-20050922
checking for RRDTool support... yes, shared
checking host system type... i686-pc-linux-gnu
checking build system type... i686-pc-linux-gnu
checking for ranlib... (cached) ranlib
checking for ld used by GCC... (cached) /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... (cached) yes
checking for BSD-compatible nm... (cached) /usr/bin/nm -B
checking whether ln -s works... (cached) yes
loading cache ./config.cache within ltconfig
checking for object suffix... o
checking for executable suffix... (cached) no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.lo... yes
checking if gcc supports -fno-rtti -fno-exceptions ... no
checking if gcc static flag -static works... -static
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the linker (/usr/bin/ld) supports shared libraries... yes
checking command to parse /usr/bin/nm -B output... ok
checking how to hardcode library paths into programs... immediate
checking for /usr/bin/ld option to reload object files... -r
checking dynamic linker characteristics... Linux ld.so
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for objdir... .libs
creating libtool
loading cache ./config.cache
checking for working mkdir -p... (cached) yes
creating config_vars.mk
creating Makefile
creating ./config.status
creating config.h
config.h is unchanged
Then making
[ravit at SSDG17 php4-rrdtool-1.03]$ make
make[1]: Entering directory `/home/ravit/RRDIns/PhpRRD/php4-rrdtool-1.03'
make[1]: Nothing to be done for `all-p'.
make[1]: Leaving directory `/home/ravit/RRDIns/PhpRRD/php4-rrdtool-1.03'
Then Install:
[root at SSDG17 php4-rrdtool-1.03]# make install
make[1]: Entering directory `/home/ravit/RRDIns/PhpRRD/php4-rrdtool-1.03'
installing shared modules into
/usr/local/lib/php/extensions/no-debug-non-zts-20050922
make[1]: Leaving directory `/home/ravit/RRDIns/PhpRRD/php4-rrdtool-1.03'

After this I have tried to execute an example scripts from the untarred
files.
[ravit at SSDG17 ~]$ ./rrd_create.php  ( You can see the code at the bottom)

Warning: dl(): Unable to load dynamic library './rrdtool.so' - ./rrdtool.so:
cannot open shared object file: No such file or directory in
/home/ravit/rrd_create.php on line 8
 This is a php script to create an rrd databse file

Fatal error: Call to undefined function rrd_create() in
/home/ravit/rrd_create.php on line 22


#! /usr/local/bin/php -q  ( this is php5.1.x)
<?
 dl("rrdtool.so");

     " echo " This is a php script to create an rrd databse file \n";
  $_opts = array( "--step", "300", "--start", 0,
                 "DS:input:COUNTER:900:0:U",
                 "DS:output:COUNTER:900:0:U",
                 "RRA:AVERAGE:0.5:1:1000",
                 "RRA:MIN:0.5:1:1000",
                 "RRA:MAX:0.5:1:1000"
               );

  $ret = rrd_create("/tmp/test.rrd", $_opts, count($_opts));

  if ( $ret == 0 )
  {
      $err = rrd_error();
      echo "Create error: $err\n";
  }

  ..........
 ?>


If I  replace the first line of the code with /usr/bin/php -q  which is php4
 I am getting the following error :

[ravit at SSDG17 ~]$ ./rrd_create.php
This is a php script to create an rrd databse file
Segmentation fault
(not getting the same error as previous execution)

My attempt  is to run php scripts in the command prompt as well as on Apache
Server with RRD funcrions

I  ran phpinfo() function from my apache2.2.2 sever which gave a the output
as shown in the attachment to this mail.

-- 

Ravi.Thati
Our Attempts may fail but we should not fail to attempt.



-- Attached file removed by Ecartis and put at URL below --
-- Type: text/html
-- Size: 40k (41910 bytes)
-- URL : http://lists.ee.ethz.ch/p/first.php.html


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list