• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

ODBC-Driver

datFlo

New Pleskian
Is there a way to enable the php functions like odbc_connect?

OS: Debian 8.6
Product Plesk Onyx
Version 17.0.17 Update #6, last updated on Nov 15, 2016 11:39 AM

Thank you in advance for any help :)
 
Hi datFlo,

let's assume, that you installed the PHP5 - extension "php5-odbc", then you should make sure, that it has been enabled with for example "extension = odbc.so" at your depending "php.ini" ( Example: "/etc/php5/apache2/php.ini" ). This can as well being achieved on Debian/Ubuntu based systems, by using the "/etc/php5/apache2/conf.d/" directory and a corresponding symlink from "/etc/php5/mods-available/odbc.ini", where you should see "extension = odbc.so". If this is all set, you are able to use the mentioned functions.
 
Hey @UFHH01 thanks for the fast reply. :)

But new error occured: "mod_fcgid: stderr: PHP Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed, SQL state IM004 in SQLConnect"

Code:
Code:
define('MSSQL_HOST', 'xxx.xxx.xxx'); // external MSSQL-DB under Windows Server2012 
define('MSSQL_USER', 'xxxxxxxxx');              
define('MSSQL_PASS', 'xxxxxxxxxxxx');


    $connection = odbc_connect('Driver={/opt/plesk/php/5.6/lib/php/modules/odbc.so};Server='.MSSQL_HOST.';', MSSQL_USER, MSSQL_PASS);
   $dbQuery = @odbc_exec($connection, '
               USE [TEST]
               SELECT TOP *
               FROM [Tabelle]
           ');
   while($result = @odbc_fetch_array($dbQuery)) {
       echo $result['id']."<br />";
   }
 
Last edited:
Hi datFlo,

it seems, that unixODBC can't create a needed environment ( "SQL_HANDLE_HENV" ). You might consider to add at your "odbc.ini" :

Code:
[conn]
Description= DB2 Driver
Driver = DB2
DMEnvAttr = SQL_ATTR_UNIXODBC_ENVATTR={DB2INSTANCE=db2instl}
 
Back
Top