• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

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