Connection Problems from PHP to IBM DB2

Connection Problems from PHP to IBM DB2

Post by Jens Brillinge » Sat, 19 May 2001 23:33:48



I used the "mod_php4-4.0.4pl1-1.src.rpm" from SuSE Linux 7.1 to create a rpm.

Installed Apache: 1.3.19-6
          gcc   : 2.95.2-149
          DB2 Connect Enterprise Edition: V7.1

Add library directories to /etc/ld.so.conf:
1. /usr/IBMdb2/V7.1/lib
2. /usr/IBMdb2/V7.1/include

Connect to db2 under the console of DB2 Connect works!

Modifications in /usr/src/packages/SPECS/mod_php.spec:
1. outcomment all things for roxen and adabase
2. configure-options:
./configure  --prefix=/usr --bindir=/usr/bin --libdir=/usr/lib '--with-exec-
dir=%{libdir}/php/bin' --with-mysql=/usr --with-gd=yes --with-tiff-dir=/usr --
with-jpeg-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr/X11R6 --with-
pdflib=/usr --with-zlib=yes --with-xml --with-ttf --with-ftp --with-curl --with-
gd=yes --with-ibm-db2=/home/db2inst1/sqllib --enable-bcmath --enable-trans-sid --
enable-track-vars --enable-magic-quotes --enable-safe-mode --enable-sockets --
enable-calendar --enable-ftp --enable-memory-limit --with-config-file-
path=/etc/httpd --with-apxs=/usr/sbin/apxs --with-exec-dir=/usr/lib/apache/bin
i386-suse-linux-gnu

Start producing rpm:
   rpm bb /usr/src/packages/SPECS/mod_php4.spec

Try to install the rpm:
   rpm -i "mod_php4-4.0.4pl1-1.i386.rpm"

When I do this I get the messages:
  error: failed dependencies:  
          /usr/bin/php is needed by mod_php4-4.0.4pl1-1
          libdb2.so.1 is needed by mod_php4-4.0.4pl1-11    
          libstdc++-libc6.1-1.so.2 is needed by mod_php4-4.0.4pl1-1

- the folder "/usr/bin/php" really doesn't exist
- i located the file "libdb2.so.1" in the folder "/usr/IBMdb2/V7.1/lib/"
-  i located the file "libstdc++-libc6.1-1.so.2" in the folder "/usr/lib/"

checking "libphp4.so":
    Result of the command "ldd /usr/lib/apache/libphp4.so" :
        libpng.so.2 => /usr/lib/libpng.so.2 (0x40161000)
        libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x4018c000)
        libncurses.so.5 => /lib/libncurses.so.5 (0x4019b000)
        libpam.so.0 => /lib/libpam.so.0 (0x401e5000)
        libssl.so.0 => /usr/lib/libssl.so.0 (0x401ed000)
        libdb2.so.1 => /usr/IBMdb2/V7.1/lib/libdb2.so.1 (0x4021a000)
        libdl.so.2 => /lib/libdl.so.2 (0x40a41000)
        libz.so.1 => /lib/libz.so.1 (0x40a44000)
        libpdf.so.1 => /usr/lib/libpdf.so.1 (0x40a54000)
        libtiff.so.3 => /usr/lib/libtiff.so.3 (0x40a7e000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x40ac1000)
        libmysqlclient.so.10 => /usr/lib/libmysqlclient.so.10 (0x40ae0000)
        libttf.so.2 => /usr/lib/libttf.so.2 (0x40b0f000)
        libgd.so.4 => /usr/lib/libgd.so.4 (0x40b37000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40b68000)
        libcurl.so.0 => /usr/lib/libcurl.so.0 (0x40c4b000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x40c67000)
        libm.so.6 => /lib/libm.so.6 (0x40c78000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x40c96000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x40cc4000)
        libc.so.6 => /lib/libc.so.6 (0x40cda000)
        libcrypto.so.0 => /usr/lib/libcrypto.so.0 (0x40ded000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x40ead000)
        libstdc++-libc6.1-1.so.2 => /usr/lib/libstdc++-libc6.1-1.so.2
(0x40ec4000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

    It seems that the links to the librarys are correct (or not?).

What's the problem?????

On the machine I generated the rpm php is working, but I can't get the connect
to DB2 via PHP.

phpinfo():
  ODBC library: db2
  ODBC_INCLUDE: -I/home/db2inst1/sqllib/include
  ODBC_LFLAGS:  -L/home/db2inst1/sqllib/lib
  ODBC_LIBS:    -ldb2

Error-message when I try connect DB2 via PHP:
  Warning: SQL error: , SQL state in SQLConnect in
/usr/local/httpd/htdocs/PHP/connect_test_db2.php on line 10

line 10 in the script: $conn = odbc_connect($dsn,$user,$passwd);

Is there a mistake or is the problem the failed dependencies from the rpm-
installation????
--
__________________________________________________________
News suchen, lesen, schreiben mit http://newsgroups.web.de

 
 
 

Connection Problems from PHP to IBM DB2

Post by Robert Dea » Sun, 20 May 2001 00:26:17


When I had that error, it was because the user id the webserver was
running as did not have access rights to the database (irrespective
of the user and pass on the odbc_connect call).  

Robert

[snip]

Quote:> What's the problem?????

> On the machine I generated the rpm php is working, but I can't get the connect
> to DB2 via PHP.

> phpinfo():
>   ODBC library: db2
>   ODBC_INCLUDE: -I/home/db2inst1/sqllib/include
>   ODBC_LFLAGS:  -L/home/db2inst1/sqllib/lib
>   ODBC_LIBS:    -ldb2

> Error-message when I try connect DB2 via PHP:
>   Warning: SQL error: , SQL state in SQLConnect in
> /usr/local/httpd/htdocs/PHP/connect_test_db2.php on line 10

> line 10 in the script: $conn = odbc_connect($dsn,$user,$passwd);

> Is there a mistake or is the problem the failed dependencies from the rpm-
> installation????
> --
> __________________________________________________________
> News suchen, lesen, schreiben mit http://newsgroups.web.de


 
 
 

Connection Problems from PHP to IBM DB2

Post by Dan Scot » Thu, 24 May 2001 03:27:35


Add the following line to the start of apachectl:

". /home/db2inst1/sqllib/db2profile"

Apache needs to inherit the DB2 instance environment settings
so that it can successfully execute the PHP -> DB2 commands.

Dan


> I used the "mod_php4-4.0.4pl1-1.src.rpm" from SuSE Linux 7.1 to create a rpm.

> Installed Apache: 1.3.19-6
>           gcc   : 2.95.2-149
>           DB2 Connect Enterprise Edition: V7.1

<snip>

Quote:

> Error-message when I try connect DB2 via PHP:
>   Warning: SQL error: , SQL state in SQLConnect in
> /usr/local/httpd/htdocs/PHP/connect_test_db2.php on line 10

> line 10 in the script: $conn = odbc_connect($dsn,$user,$passwd);

> Is there a mistake or is the problem the failed dependencies from the rpm-
> installation????

--
--
Dan Scott
daniels at ca dot ibm dot com
 
 
 

1. Problem with ODBC Connection to DB2 via PHP

Hallo,

habe folgendes Problem
Ich m?chte mit PHP auf DB2 ber die ODBC Funktionen zugreifen.
Bekomme aber beim odbc-connect folgenden Fehler

Warning: SQL error: [Microsoft][ODBC Driver Manager] Der
Datenquellenname wurde nicht gefunden, und es wurde kein
Standardtreiber angegeben., SQL state IM002 in SQLConnect in
e:\workbench\db2 connect\db2lib.php on line 10
Connection to database failed.
Warning: odbc_errormsg(): supplied argument is not a valid ODBC-Link
resource in e:\workbench\db2 connect\db2lib.php on line 14

Der ODBC Treiber ist meiner Meinung nach korrekt installiert, weil ich
per ACCESS auf die DB2 Datenbank zugreifen kann.

Ich vermute ich hab eher ein Problem mit der PHP Konfiguration.

Es ist eine Standardwindowsinstallation von PHP4 ber das EASYPHP 1.6
.
Ich habe leider bislang keine Informationen , die mir weiterhelfen im
Netz gefunden.

Hat irgendwer einen Tip ?!
(Den Tip eine andere DB zu verwenden ist bestimmt gut, aber nicht
m?glich ;-) )

Sabrina

2. How to create self increment fields?

3. Call IBM DB2 stored procedure from PHP

4. Migrating from 7.3 to 8 via export

5. ibm db2 + php

6. BDE Distribution

7. IBM DB2 e PHP

8. MS SQL65. Extended Stored Procedure Equivalent?

9. Differences between COM.ibm.db2.jdbc.app.DB2Driver and COM.ibm.db2.jdbc.net.DB2Driver

10. PHP and DB2 - anyone done anything with PHP?

11. LU62 CONNECTION TO IBM DB2 VIA SQLNET ORACLE NT SERVER 7.3.3

12. Connection to IBM DB2 database with VB.net

13. data migration from IBM DB400 to IBM DB2