FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP and DB2 on an IIS Server
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
PHP and DB2 on an IIS Server [message #172725] Sun, 27 February 2011 16:45 Go to next message
Charles Buege is currently offline  Charles Buege
Messages: 1
Registered: February 2011
Karma: 0
Junior Member
Hello all out there.

I'm attempting to get an IIS Server running with PHP (which I can do in my sleep by this point) but I'd like to enable the PHP server to do DB2 lookups on our iSeries AS/400 (V5R4M0 in
case that matters). I've gone done the following:

Setup the IIS Server.
Configured and tested PHP extensively. I can make connections to MySQL and SQL Server devices with no problem at all.
Downloaded and copied into the PHP\ext directory php_ibm_db2.dll file.
I've modified the php.ini to include extension=php_ibm_db2.dll
I've restarted the web server.
But each time I try to use the following code, I get the following error: Fatal error: Call to undefined function db2_connect() in C:\phptest\baredata.php on line 17

<?php
//Establish connection to database
$host = "mysystem.mydomain.com";
$conn = db2_connect($host,"(valid user name)", "(valid password)");

Any additional information that you request, I'll be happy to provide it.

Would anyone out there have any idea where I could go for my next attempt to get this working? Please feel free to email me at cbuege at moreycorp dot com with any suggestions you
have. I'm ready to pull my hair out over this!! *laughs* I'm SURE, at this point, that I'm missing something as simple as uncommenting a line of code or some other stupid thing like
that, so any help would be greatly appreciated.

Thank you,
Charles


--
--------------------------------- --- -- -
Posted with NewsLeecher v5.0 Beta 1
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -
Re: PHP and DB2 on an IIS Server [message #172730 is a reply to message #172725] Sun, 27 February 2011 18:39 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/27/2011 11:45 AM, Charles Buege wrote:
> Hello all out there.
>
> I'm attempting to get an IIS Server running with PHP (which I can do in my sleep by this point) but I'd like to enable the PHP server to do DB2 lookups on our iSeries AS/400 (V5R4M0 in
> case that matters). I've gone done the following:
>
> Setup the IIS Server.
> Configured and tested PHP extensively. I can make connections to MySQL and SQL Server devices with no problem at all.
> Downloaded and copied into the PHP\ext directory php_ibm_db2.dll file.
> I've modified the php.ini to include extension=php_ibm_db2.dll
> I've restarted the web server.
> But each time I try to use the following code, I get the following error: Fatal error: Call to undefined function db2_connect() in C:\phptest\baredata.php on line 17
>
> <?php
> //Establish connection to database
> $host = "mysystem.mydomain.com";
> $conn = db2_connect($host,"(valid user name)", "(valid password)");
>
> Any additional information that you request, I'll be happy to provide it.
>
> Would anyone out there have any idea where I could go for my next attempt to get this working? Please feel free to email me at cbuege at moreycorp dot com with any suggestions you
> have. I'm ready to pull my hair out over this!! *laughs* I'm SURE, at this point, that I'm missing something as simple as uncommenting a line of code or some other stupid thing like
> that, so any help would be greatly appreciated.
>
> Thank you,
> Charles
>
>

Did you install and load the php db2 extension? Is the DB2 client
installed on this machine (and the client libraries available to the web
server)?

Finally, after checking the above, what does phpinfo() show?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: PHP and DB2 on an IIS Server [message #172733 is a reply to message #172730] Sun, 27 February 2011 18:47 Go to previous messageGo to next message
Charles is currently offline  Charles
Messages: 13
Registered: February 2011
Karma: 0
Junior Member
Jerry -

Thanks for such a quick response!!

To answer your questions....
Did you install and load the php db2 extension?
What I did here was download the php_ibm_db2.dll, put it into the extension (php\ext) directory, and added 'extension=php_ibm_db2.dll' to the end of the php.ini file that is being used.
What more do I need to do to 'install and load' the db2 extension? I'm having a hard time finding any documentation on how to manually install db2 onto a Windows box (plenty of info
for linux/unix, but not Windows).

Is the DB2 client installed on this machine (and the client libraries available to the web server)?
Here, I don't know what to tell you. I've tried installing IBM's iSeries Client Access as I do know part of that install does install ODBC drivers, but I'm trying to do it via direct
DB2 function calls, not via ODBC. I want to get this working as server-agnostic as possible so I can port this code to another PHP server as I need to. I've tried installing DB2 Exec
9.72 for Windows, I've tried installing the IBM Data Server for ODBC and CLI for Windows, and I'm not sure what else to install to get the 'client libraries' on there. If you'd make
any suggestions, please feel free to send them my way.

Thanks,
Charles
cbuege at moreycorp dot com


--
--------------------------------- --- -- -
Posted with NewsLeecher v5.0 Beta 1
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -
Re: PHP and DB2 on an IIS Server [message #172737 is a reply to message #172733] Sun, 27 February 2011 19:05 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 2/27/2011 1:47 PM, Charles wrote:
> Jerry -
>
> Thanks for such a quick response!!
>
> To answer your questions....
> Did you install and load the php db2 extension?
> What I did here was download the php_ibm_db2.dll, put it into the extension (php\ext) directory, and added 'extension=php_ibm_db2.dll' to the end of the php.ini file that is being used.
> What more do I need to do to 'install and load' the db2 extension? I'm having a hard time finding any documentation on how to manually install db2 onto a Windows box (plenty of info
> for linux/unix, but not Windows).
>

Check the IBM site for what you need to install DB2 on Windows. I found
it to be quite easy to install on Windows (but I don't use it with PHP).
If you still can't get DB2 installed, try the comp.databases.ibm-db2
newsgroup. And the DB2 client DLLs must be loadable (i.e. in a
directory in the PATH environment variable or similar).

> Is the DB2 client installed on this machine (and the client libraries available to the web server)?
> Here, I don't know what to tell you. I've tried installing IBM's iSeries Client Access as I do know part of that install does install ODBC drivers, but I'm trying to do it via direct
> DB2 function calls, not via ODBC. I want to get this working as server-agnostic as possible so I can port this code to another PHP server as I need to. I've tried installing DB2 Exec
> 9.72 for Windows, I've tried installing the IBM Data Server for ODBC and CLI for Windows, and I'm not sure what else to install to get the 'client libraries' on there. If you'd make
> any suggestions, please feel free to send them my way.
>
> Thanks,
> Charles
> cbuege at moreycorp dot com
>
>

Check the appropriate DB2 resources, as noted above.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: PHP and DB2 on an IIS Server [message #172740 is a reply to message #172725] Sun, 27 February 2011 19:32 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On 27/02/11 16:45, Charles Buege wrote:

> Downloaded and copied into the PHP\ext directory php_ibm_db2.dll file.
> I've modified the php.ini to include extension=php_ibm_db2.dll

> But each time I try to use the following code, I get the following error: Fatal error: Call to undefined function db2_connect() in C:\phptest\baredata.php on line 17
>
> <?php
> //Establish connection to database
> $host = "mysystem.mydomain.com";
> $conn = db2_connect($host,"(valid user name)", "(valid password)");

Hmm, sounds like either:

a) file access permissions problem (the dll or the ini file)
b) dll file in the wrong place
c) ini file entry wrong

I had a similar problem under linux where the web server could access
curl functions but I couldn't access them from the command line - in
that case it was because the command line user didn't have read access
to the ini snippet that included curl, but I don't know if php under iis
uses ini snippets or not.

eg in my linux server setup, the dir:

/etc/php5/conf.d

contains files like "curl.ini" which contain text like:

; configuration for php CURL module
extension=curl.so

Then I also have a "cli" and an "apache2" dir under /etc/php5, both of
which contain a link "conf.d" to "/etc/php5/conf.d" and a cli or web
server specific php.ini

Also, is it the same version of IIS as you normally set up php on? Are
there differences eg between IIS6 and IIS7 php installs?

Also, perhaps:

<?php
if (!extension_loaded('db2')) {
if (!dl('php_ibm_db2.dll')) {
die("failed to load db2 extension\n");
}
}
?>

Rgds

Denis McMahon
Re: PHP and DB2 on an IIS Server [message #172741 is a reply to message #172725] Sun, 27 February 2011 19:40 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On 27/02/11 16:45, Charles Buege wrote:

> But each time I try to use the following code, I get the following error: Fatal error: Call to undefined function db2_connect() in C:\phptest\baredata.php on line 17

Oh, also:

<?php
if (!extension_loaded('db2')) {
if (!dl('php_ibm_db2.dll')) {
die("\n");
}
}

print_r(get_extension_funcs("db2"));
?>

just to check that the function names are what you're expoecting.

Rgds

Denis McMahon
Re: PHP and DB2 on an IIS Server [message #172742 is a reply to message #172725] Sun, 27 February 2011 19:45 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On 27/02/11 16:45, Charles Buege wrote:

> I'm attempting to get an IIS Server running with PHP (which I can do in my sleep by this point)

One other thing I noticed .... I think you're using the php4 default
location for the extensions and not the php5 one .... could that be the
issue?

Rgds

Denis McMahon
Re: PHP and DB2 on an IIS Server [message #172750 is a reply to message #172725] Sun, 27 February 2011 21:55 Go to previous message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma: 0
Senior Member
On 27 Feb 2011 16:45:59 GMT, Charles Buege wrote:

> Hello all out there.
>
> I'm attempting to get an IIS Server running with PHP (which I can do
> in my sleep by this point) but I'd like to enable the PHP server to do
> DB2 lookups on our iSeries AS/400 (V5R4M0 in case that matters). I've
> gone done the following:
>
> Setup the IIS Server. Configured and tested PHP extensively. I can
> make connections to MySQL and SQL Server devices with no problem at
> all. Downloaded and copied into the PHP\ext directory php_ibm_db2.dll
> file. I've modified the php.ini to include extension=php_ibm_db2.dll
> I've restarted the web server. But each time I try to use the
> following code, I get the following error: Fatal error: Call to
> undefined function db2_connect() in C:\phptest\baredata.php on line 17

It's not loading the DB2 stuff. Check the output of phpinfo(), but I'm
betting it's not there.

Additionally, it's been a while since I played with it, but from what
I remember, iSeries DB2 isn't quite the same enough as DB2 for other
systems to work well with PHP, and you may need the rebuild one from
zend and IBM. (I have a vague impression that the issues is that the
iSeries DB2 doesn't speak DB2 wire protocol to the outside world, only
DRDA (which is kind of like "big boy ODBC" for clusters), and the DB2
extensions are wire protocol, but any of these details may be wrong.)

--
Better to teach a man to fish than to give him a fish. And if he can't
be bothered to learn to fish and starves to death, that's a good enough
outcome for me.
-- Steve VanDevender
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: problem with web service
Next Topic: [ANN]VTD-XML 2.10
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 20:26:43 GMT 2024

Total time taken to generate the page: 0.02307 seconds