My first guess would be to make sure that the version of PHP that you are running from CLI is the same as the one running as an apache module, and that they are configured the same. When running the CLI, do an
<?php phpinfo(); ?> And compare the output with what you get from doing the same thing from the web. -Logan -----Original Message----- From: Leo Jokinen [mailto:[EMAIL PROTECTED] Sent: Monday, April 16, 2007 10:22 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; php-general@lists.php.net Subject: [PHP] Problems when trying to use ibm_db2 extension 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php