title: PHP Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib. Connection to Snowflake in php is not working but isql connection is
body: <p>I am able to connect and query with isql to my snowflake server but when I attempt to do so with a php odbc_connect I get the following error.</p>
  <pre><code>PHP Warning:  odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib '/var/www/html/odbc_test/snowflake/snowflake_odbc/lib/libSnowflake.so' : file not found, SQL state 01000 in SQLConnect in /var/www/html/test/snowflake.php on line 29
  </code></pre>
  <p>I've never set up a odbc connection before and followed the snowflake provided guide here <a href="https://docs.snowflake.com/en/user-guide/odbc-linux.html" rel="nofollow noreferrer">https://docs.snowflake.com/en/user-guide/odbc-linux.html</a>.</p>
  <p>The first thing I tried when after getting the error was to set the permissions on /var/www/html/odbc_test/snowflake/snowflake_odbc/lib/libSnowflake.so  that did not work so I then set to to 777, still didn't work.</p>
  <p>Here is the php code.</p>
  <pre><code>&lt;?php
  //values checked with https://docs.snowflake.com/en/user-guide/odbc-parameters.html
  $SNOWFLAKE_HOST = 'snowflakecomputing.com';
  $SNOWFLAKE_ACCOUNT = 'xxxx;
  $SNOWFLAKE_PORT = '443';
  $SNOWFLAKE_SCHEMA = 'xxxx';
  $SNOWFLAKE_WAREHOUSE = 'xxxx';
  $SNOWFLAKE_DATABASE = 'xxxx';
  $SNOWFLAKE_USER = 'xxxx';
  $SNOWFLAKE_PASSWORD = 'xxxx';
  
  
  
  $dsn = &quot;Driver=SnowflakeDSIIDriver;Server=&quot; . $SNOWFLAKE_HOST;
  $dsn .= &quot;;Account=&quot; . $SNOWFLAKE_ACCOUNT;
  $dsn .= &quot;;Port=&quot; . $SNOWFLAKE_PORT;
  $dsn .= &quot;;Schema=&quot; . $SNOWFLAKE_SCHEMA;
  $dsn .= &quot;;Warehouse=&quot; . $SNOWFLAKE_WAREHOUSE;
  $dsn .= &quot;;Database=&quot; . $SNOWFLAKE_DATABASE;
  
  $conn_id = odbc_connect($dsn, $SNOWFLAKE_USER, $SNOWFLAKE_PASSWORD);
  odbc_exec($conn_id, &quot;USE WAREHOUSE &quot; . $SNOWFLAKE_WAREHOUSE);
  
  $res = odbc_exec($conn_id, 'SHOW TABLES IN SCHEMA ' . $SNOWFLAKE_SCHEMA . ';');
  if ($res) {
      print &quot;Tables in schema\n&quot;;
      while($row = odbc_fetch_array($res)) {
          print_r($row);
      }
  }
  
  $res = odbc_exec($conn_id, 'SELECT * FROM TEST;');
  if ($res) {
      print &quot;Test table content\n&quot;;
      while($row = odbc_fetch_array($res)) {
          print_r($row);
      }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/vUk0V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vUk0V.png" alt="enter image description here" /></a></p>