各位好,公司有个项目要用php和DB2开发,程序已经写好了,在我本地上也能运行,现在部署到centos服务器上运行不了,提示db2_connect未定义,想请大家帮下忙,在CENTOS上如何配置PHP与odbc的按链接操作,十分感谢!我找了二天了,都没有任何进展,哭的心都有了,希望大家能帮下我

解决方案 »

  1.   

    db2_connect未定义 应该是你没装db2扩展吧?
    http://www.cnblogs.com/gbyukg/archive/2011/10/09/2204916.html
    这篇文章下面有安装db2扩展的说明(系统:centos db2版本>=975)
      

  2.   

    楼上的,小弟是新手,不是很熟悉,那个CENTOS的PHP不是原来就自带了的吗,麻烦帮忙指点下
      

  3.   

    要是系统上已经安装好PHP 直接装db2扩展就可以了 可以自己下,也可以利用pecl直接安装(推荐)
    pecl install ibm_db2
      

  4.   

    楼上的,已经试了您说的这种方法,提示啊了DB2 CLI之类的
      

  5.   

    [root@gsidc-ywxt-wl03 DB2]# pecl install ibm_db2
    downloading ibm_db2-1.9.3.tgz ...
    Starting to download ibm_db2-1.9.3.tgz (156,494 bytes)
    .................................done: 156,494 bytes
    5 source files, building
    running: phpize
    Configuring for:
    PHP Api Version:         20041225
    Zend Module Api No:      20050922
    Zend Extension Api No:   220051025
    DB2 Installation Directory? : /path/to/DB2
    building in /var/tmp/pear-build-root/ibm_db2-1.9.3
    running: /tmp/tmplV9Ev0/ibm_db2-1.9.3/configure --with-IBM_DB2=/path/to/DB2
    checking for egrep... grep -E
    checking for a sed that does not truncate output... /bin/sed
    checking for gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables...
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ANSI C... none needed
    checking whether gcc and cc understand -c and -o together... yes
    checking if compiler supports -R... no
    checking if compiler supports -Wl,-rpath,... yes
    checking build system type... i686-redhat-linux-gnu
    checking host system type... i686-redhat-linux-gnu
    checking target system type... i686-redhat-linux-gnu
    checking for PHP prefix... /usr
    checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext
    checking for PHP extension directory... /usr/lib/php/modules
    checking for PHP installed headers prefix... /usr/include/php
    checking for re2c... no
    configure: WARNING: You will need re2c 0.9.11 or later if you want to regenerate PHP parsers.
    checking for gawk... gawk
    checking for IBM_DB2 support... yes, shared
    checking Looking for DB2 CLI libraries... checking      in /path/to/DB2...
    checking      in /path/to/DB2/lib64...
    checking      in /path/to/DB2/lib32...
    checking      in /path/to/DB2/lib...
    not found
    configure: error: Please reinstall the DB2 CLI distribution
    ERROR: `/tmp/tmplV9Ev0/ibm_db2-1.9.3/configure --with-IBM_DB2=/path/to/DB2' failed
      

  6.   

    You will need re2c 0.9.11 or later if you want to regenerate PHP parsers
    你用版本太低了。
    用re2c或是You will need re2c 0.9.11 or later if you want to regenerate PHP parsers.搜一搜