php and DB2

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
bojin
Forum Newbie
Posts: 4
Joined: Wed Jun 11, 2008 9:05 am

php and DB2

Post by bojin »

I am relatively new to php and I have one task to accomplish.
Underlying DBMS to my php application is not MySQL, but IBM DB2 and I would like to know how can I access my database from my php script?

I wanted to use db2_connect() function in my script, but when I called it a fatal error occurred, stating that undefined function was called. Perhaps, the better question would be - how can I configure my locally installed php engine, so that I can use that (ant other) php functions from php's DB2 library? Just for the sake of information, I am using Windows XP operating system with xampp 1.6.3a with the php 5.2.3 and apache 2.2.4.

I would appreciate a lot any kind of help.

Best regards,
Aleksandar
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: php and DB2

Post by superdezign »

I think you have to enable those functions in php.ini or httpd.conf. In all likeliness, if you look in those files, one of them will have the line commented that enables DB2 functions.
bojin
Forum Newbie
Posts: 4
Joined: Wed Jun 11, 2008 9:05 am

Re: php and DB2

Post by bojin »

On the line 603 in the file php.ini is the following:
;extension=php_ibm_db2.dll
When I uncomment it (i.e. remove semicolon), save php.ini file and restart the server the same error still occurs. So that does not help.

Any suggestions for changes in other files?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: php and DB2

Post by superdezign »

Make sure that file is in the apache/php/ext folder. If it is, then I'm not sure what else to tell you. o_O
bojin
Forum Newbie
Posts: 4
Joined: Wed Jun 11, 2008 9:05 am

Re: php and DB2

Post by bojin »

The folder php does not exist in the structure of the folder apache.
The structure look as follows (c.f. attachment):

Image

So there are two php.ini files (one in the apache/bin folder and one in the php folder). In both files I have uncommented the line that contains php_ibm_db2.dll. Both folders ext and extension (from the php folder) have .dll file called php_ibm_db2.dll.

Now, I don't know where did I get wrong?
Attachments
Snap_ 2008-06-12 00.37.27.png
Snap_ 2008-06-12 00.37.27.png (7.51 KiB) Viewed 794 times
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: php and DB2

Post by superdezign »

On Windows PCs, the php.ini file can exist in multiple places as well (One of them being the WINDOWS folder, which gets top-priority), but only one is used. Try using phpinfo() to see if it mentions DB2 and, if it does, what it mentions about it.
bojin
Forum Newbie
Posts: 4
Joined: Wed Jun 11, 2008 9:05 am

Re: php and DB2

Post by bojin »

phpinfo() doesn't show me any information on DB2. I've searched for php.ini files within the Windows folder, but the search returned zero results.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: php and DB2

Post by Weirdan »

phpinfo() shows the exact location of php.ini file used. You don't have to search for it.
Post Reply