title: Fatal error: Call to undefined function db2_connect() using WAMP when trying to connect to Derby DB
body: <p>I hope someone can help me with this error. I know it pops up due to php not recognizing the php_ibm_db2.dll module, but I've tried everything and nothing works. I've looked for tutorials, but many of them are very old and refers to the old version of IBM products which makes it harder for me to understand.</p>
  
  <p>Older similar questions posted here either goes unanswered or solved vaguely.</p>
  
  <p>Here are the basics:</p>
  
  <ul>
  <li>System: Windows 7 Pro 64bit</li>
  <li>WAMP: 2.5 64bit (Apache is 2.4.9 &amp; PHP is 5.5.12)</li>
  <li>Database: Derby, located in the same computer as WAMP/localhost</li>
  </ul>
  
  <p>I needed to connect to the db using php and retrieve the data. I tried using odbc but I received 'Function Unsupported' with both IBM DB2 ODBC Driver and IBM Data Server Driver for ODBC, so I scrapped the idea and decided to go with db2 functions instead.</p>
  
  <p>Here's what I've tried:</p>
  
  <ul>
  <li>Downloaded extension from <a href="http://sourceforge.net/projects/db2mc/files/IBM_DB2%20PHP%20Driver%20for%20Windows/" rel="nofollow">here</a>: I got the 5.5 ts version and copied the .dll into PHP's ext folder</li>
  <li>Added extension=php_ibm_db2.dll line in php.ini linked by WAMP</li>
  <li>Installed everything from <a href="http://www-01.ibm.com/support/docview.wss?rs=4020&amp;uid=swg27016878" rel="nofollow">IBM download page</a>. It's stupid but I don't know what to do anymore</li>
  <li>Checked if PATH, .ini or .conf settings are not pointed to the correct folder*</li>
  <li>Restarted WAMP</li>
  <li>Restarted computer</li>
  </ul>
  
  <p>*I previously configured PHP to include Firebird headers, so I know I modified the correct .conf &amp; .ini. The PHP folder is also defined in the environment variables.</p>
  
  <p>PHP error log contains the following:</p>
  
  <pre><code>PHP Warning:  PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_ibm_db2.dll' - %1 is not a valid Win32 application.
  </code></pre>
  
  <p>The code:</p>
  
  <pre><code>$username = "username";
  $password = "password";
  $hostname = "localhost";
  $port = "1527";
  $database="C:\Users\me\Desktop\dbname"; //not real definition
  
  $conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;"."HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$username;PWD=$password";
  
  $connection = db2_connect($conn_string, '', '');
  if ($connection) {
     echo "Connection succeeded."."\n";
  }
  else {
     echo "Connection failed."."\n";
     echo db2_conn_errormsg ($connection);
  }
  </code></pre>
  
  <p>Thank you in advance</p>