PHP配置rrdtool扩展 (How to build the PHP rrdtool extension)

服务器基本信息  CentOS 5. 7 X86_64  RRDtool 1.4.5  PHP 5.3.8 

第一步 访问 http://oss.oetiker.ch/rrdtool/pub/contrib/   下载  php_rrdtool.tar.gz 

STEP 1 : Go to http://oss.oetiker.ch/rrdtool/pub/contrib/ to get the PHP rrdtool source : php_rrdtool.tar.gz


第二步 解压 php_rrdtool.tar.gz 包 移动到php 的扩展目录下我这边是(/usr/include/php/ext/)执行命令如下:



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/

第三步 编译,进入/usr/include/php/ext/rrdtool 运行phpize 执行命令如下:

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 

第四步 执行 make 和make install 命令

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/


第五步 修改PHP配置文件添加 rrdtool.so 扩展 命令如下:
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
php -m


或者使用 phpinfo() 函数来查看我们添加的扩展是否成功!


环境搭好了我们就接着看 PHP如何调用rrdtool 来实现画图滴 待续……

你可能感兴趣的:(PHP,Build,扩展,documentation,extension,Warnings)