If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Configuring PHP to work with DB2 on Windows 7 Professional

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-21-11, 14:50
jmartin17 jmartin17 is offline
Registered User
 
Join Date: Sep 2011
Location: Bossier City, LA
Posts: 4
Configuring PHP to work with DB2 on Windows 7 Professional

I am having a problem when Configuring PHP to work with DB2 on Windows 7 Professional.

I followed the instructions at: Configuring PHP to work with DB2 | techs@work. When I enter http://localhost:85/ I get the BitNami Project welcome page but when I edit the sample code php application that access DB2 and go to url: http://localhost:85/phpexp.php, I get: This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.

The error.log shows: [Wed Sep 21 12:49:13 2011] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function db2_connect() in K:\\Program Files\\BitNami WAMPStack\\apache2\\htdocs\\phpexp.php on line 7.

here is the code:
<?php
$database = 'SAMPLE';
$user = 'db2admin';
$password = '*****password***';
$hostname = 'localhost';
$port = 50000;
$connection = db2_connect($database, $user, $password);
if ($connection)
{
echo "Connection succeeded."."\n";
}
else
{
echo "Connection failed.<br />";
echo 'SQLSTATE : ' . db2_conn_error() . '<br/>';
echo 'Message : ' .db2_conn_errormsg(). '<br />';
}
$sql = 'select CREATOR,NAME from sysibm.systables where type = ?';
echo $sql;
$stmt= db2_prepare($connection, $sql);
if (!$stmt)
{
echo 'The prepare failed. ';
echo 'SQLSTATE : '. db2_stmt_error() ;
echo 'Message : '. db2_stmt_errormsg();
}
else
{
db2_bind_param($stmt, 1, "type", DB2_PARAM_IN);
$type = T;
$result = db2_execute($stmt);
if (!result)
{
echo 'The execute failed .';
echo 'SQLSTATE : '. db2_stmt_error() ;
echo 'Message : '. db2_stmt_errormsg();
}
else
echo '<table align ="center" cellspacing="5" cellpadding="1"
<tr><td align="left"><b>Creator</b></td>
<td align="left"><b>Name</b></td></tr>';
}
while ($row = db2_fetch_array($stmt))
{
echo "<tr><td align=\"left\">$row[0]</td><td align=\"left\">$row[1]</td></tr>\n";
}
echo '</table>';
?>

DB2 installed at: K:\DB2_01\NODE0000\SAMPLE
K:\Program Files\IBM\SQLLIB_01
Can anyone tell me why it will not connect?

James
James R. Martin
J. Martin Associates
5185 Tara Ln., Bossier City, LA 71111 - 7810
Phone: (318) 752-4109 Cell Phone: ( 318) 773-9484
Personal e-mail: jmartin@jmartinassociates.net
Reply With Quote
  #2 (permalink)  
Old 09-21-11, 22:19
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
May be you should start from here: PHP: Installation - Manual
Reply With Quote
  #3 (permalink)  
Old 09-22-11, 09:16
jmartin17 jmartin17 is offline
Registered User
 
Join Date: Sep 2011
Location: Bossier City, LA
Posts: 4
Configuring php to work with db2 on windows 7 professional

The last step at: Configuring PHP to work with DB2 | techs@work I think took care of that.
Now the last step, setting up the PHP extension to use the db2 drivers. Unzip the PECL file you downloaded. Copy the php_ibm_db2.dll and php_pdo_odbc file to K:\Bitnami\PHP\ext\ Now edit the K:\Bitnami\PHP\php.ini file and add the following entries:
extension_dir = “K:/BitNami/php/ext”
extension=php_ibm_db2.dll
extension=php_pdo.dll
entension=php_pdo_odbc.dll
Once you have done all that, its time to recycle apache server and restart db2.

I recycle apache server and DB2. Still not connecting.

James

James R. Martin
J. Martin Associates
5185 Tara Ln., Bossier City, LA 71111 - 7810
Phone: (318) 752-4109 Cell Phone: ( 318) 773-9484
Personal e-mail: jmartin@jmartinassociates.net
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On