Re: Problems when trying to use ibm_db2 extension

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Problem solved:
I restarted my computer and after that apache loaded ibm_db2 extension.

My conclusion:
1. When you add some extensions to php.ini, you need to restart windows in order to get those extensions available through apache 2. However, those extensions are instantly available if you use php command line interface

Anyone disagree?

-Leo-

Leo Jokinen wrote:
Hi all,

I've been banging my head into the wall cause I can't get ibm_db2 extension working with Apache 2.0.59 and PHP 5.2.1 (as apache module).
(Operating system is winxp pro SP2)

For some reason, this code is working on command line but not when placed to htdocs folder:

<?php
if(function_exists('db2_connect')) {
  echo 'Function db2_connect() exists';
} else {
  echo 'Unknown function db2_connect()';
  exit;
}

echo "\nTrying to connect DB2 database..\n";

$database = 'services';
$user = 'db2admin';
$password = 'xxx';
$hostname = '127.0.0.1';
$port = 50000;
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;" .
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";
$conn = db2_connect($conn_string, '', '');

if ($conn) {
  echo "OK: Connection established\n";
  db2_close($conn);
} else {
  echo "ERROR: Connection failed\n";
}
?>

Command line output:
C:\>php c:\db2_test.php
Function db2_connect() exists
Trying to connect DB2 database..
OK: Connection established

Web output:
Unknown function db2_connect()

Some extra output:
Fatal error: Call to undefined function db2_connect() in F:\www\services.itella.net\app\webroot\index.php on line 57

Also, phpinfo() won't say nothing that module ibm_db2 is in use

More info:

php_ibm_db2.dll file is in folder C:/php-5.2.1/ext

php.ini:
extension_dir = "C:/php-5.2.1/ext"
extension=php_ibm_db2.dll

httpd.conf:
AddType application/x-httpd-php .php
LoadModule php5_module "C:/php-5.2.1/php5apache2.dll"
PHPIniDir "C:/php-5.2.1/"


Can someone point out the right direction for me?

Regards

Leo Jokinen

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux