title: php PDO ODBC DB2 construct
body: <p>I am having trouble constructing a PDO. It's a function I've never used before. Let's say these are my connection variables</p>
  
  <pre><code>$database = "BLUDB";
  $hostname = "dashdb-enterprise-FAKE.services.dal.bluemix.net"; 
  $user     = "fakeuser";   
  $password = "fakepsw";   
  $port     = 50000;          
  $driver  = "DRIVER={IBM DB2 ODBC DRIVER};";
  $dsn     = "DATABASE=$database; " .
         "HOSTNAME=$hostname;" .
         "PORT=$port; " .
         "PROTOCOL=TCPIP; " .
         "UID=$user;" .
         "PWD=$password;";
  $conn_string = $driver . $dsn;
  </code></pre>
  
  <p>I have tried this:</p>
  
  <pre><code>$conn = new PDO( "DB2:DRIVER={IBM DB2 ODBC DRIVER},HOSTNAME=dashdb-enterprise-FAKE.services.dal.bluemix.net,PORT=50000,DATABASE=BLUDB,PROTOCOL=TCPIP,UID=fakeuser,PWD=fakepsw");
  </code></pre>
  
  <p>and a few other permutations. But I keep getting this error:</p>
  
  <pre><code>Fatal error: Uncaught PDOException: could not find driver in /home/robur12/domains/idobczyce.pl/public_html/mike/dava/index.php:41 Stack trace: #0 /home/robur12/domains/idobczyce.pl/public_html/mike/dava/index.php(41): PDO-&gt;__construct('DB2:DRIVER={IBM...') #1 {main} thrown in /home/robur12/domains/idobczyce.pl/public_html/mike/dava/index.php on line 41
  </code></pre>
  
  <p>I have followed the process as described here: <a href="https://www.ibm.com/support/knowledgecenter/en/SSHRBY/com.ibm.swg.im.dashdb.doc/connecting/connect_connecting_php.html" rel="nofollow noreferrer">https://www.ibm.com/support/knowledgecenter/en/SSHRBY/com.ibm.swg.im.dashdb.doc/connecting/connect_connecting_php.html</a></p>
  
  <p>I have completed the instalation and I have even run the validation command in shell</p>
  
  <p>db2cli validate -dsn DashDB -connect -user bluadmin -passwd 'your_secret_password'</p>
  
  <p>see output below</p>
  
  <p><a href="https://i.stack.imgur.com/nlkDy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nlkDy.png" alt="enter image description here"></a></p>
  
  <p>I am running under Linux s90.linuxpl.com 4.4.27-grsec #1 SMP Tue Oct 25 20:38:40 CEST 2016 x86_64</p>
  
  <p>my php.ini only says </p>
  
  <pre><code>extension=odbc.so
  </code></pre>
  
  <p>in the web browser <code>phpinfo();</code>  will return</p>
  
  <pre><code>'./configure' '--prefix=/usr/local/php7.3' '--disable-debug' '--disable-ipv6' '--enable-bcmath' '--enable-calendar' '--enable-ctype' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-inline-optimization' '--enable-mbstring' '--enable-pcntl' '--enable-pdo' '--enable-session' '--enable-soap' '--enable-sockets' '--enable-sysvsem' '--enable-wddx' '--enable-zip' '--with-bz2' '--with-config-file-path=/usr/local/php7.3' '--with-pear=/usr/local/php7.3/lib/php' '--with-curl=/usr/local/lib' '--with-freetype-dir' '--with-freetype-dir=/usr/local/lib' '--with-gd' '--with-gdbm' '--with-gettext' '--with-iconv=/usr/local' '--with-imap-ssl' '--with-imap=/usr/lib/' '--with-jpeg-dir=/usr/local/lib' '--with-kerberos' '--with-ldap' '--with-ldap-sasl' '--with-mcrypt' '--with-mhash' '--with-mysqli=mysqlnd' '--with-openssl=/usr/local/adds/openssl' '--with-pcre-regex' '--with-pdo-mysql=mysqlnd' '--with-png-dir=/usr/local/lib' '--with-pspell' '--with-readline' '--with-tidy' '--with-xmlrpc' '--with-xsl' '--with-zlib' '--with-zlib-dir=/usr/local/lib' '--enable-opcache' '--with-pdo-pgsql=/usr/local/pgsql' '--with-pgsql=/usr/local/pgsql' '--enable-intl' '--with-pdo-odbc=ibm-db2,/usr/local/adds/dsdriver'
  </code></pre>
  
  <p>but when I run <code>php -m</code> in the command line I do NOT see ibm_db2 and I do NOT see pdo_ibm. I only see the following:</p>
  
  <p><a href="https://i.stack.imgur.com/Ih1Ej.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ih1Ej.png" alt="enter image description here"></a></p>
  
  <p>I have contacted my php server provider and asked then:</p>
  
  <p>"can you possibly instal the following php modules: pdo_ibm and ibm_db2?"</p>
  
  <p>and they replied:</p>
  
  <p>"it seems you are trying to access IBM DB2.</p>
  
  <p>you should be using the PDO function following the instructions here:</p>
  
  <p><a href="https://www.php.net/manual/en/ref.pdo-odbc.php" rel="nofollow noreferrer">https://www.php.net/manual/en/ref.pdo-odbc.php</a></p>
  
  <p>we have compiled pdo ibm_db2 for you on Friday.
  PDO Driver for ODBC (ibm-db2) => enabled
  if you require other modules to be installed please provide a link or documentation"</p>