Skip to content

Undefined constant ODBC_BINMODE_RETURN and SQL_CUR_USE_DRIVER when running MS SQL Server

It's a common issue when running phpGrid inside Windows/Apache/PHP with database type as MS SQL Server

Notice
: Use of undefined constant ODBC_BINMODE_RETURN - assumed 'ODBC_BINMODE_RETURN' in / server/adodb5/adodb.inc.php on line 4249
Notice: Use of undefined constant SQL_CUR_USE_DRIVER - assumed 'SQL_CUR_USE_DRIVER' in / /server/adodb5/adodb.inc.php on line 4249

1. First of all, you must install the PHP driver for MS SQL. Download and install the driver from Microsoft website: 
http://msdn.microsoft.com/en-us/sqlserver/cc299381.aspx

2. After installing the driver, the final step is to enable the drive extension in php.ini.
http://technet.microsoft.com/en-us/library/cc296203(v=sql.105).aspx

3. Don't forget to restart the Apache after updating php.ini. 

4. To make sure the extension is installed, create a sample file that contains:

<?php phpinfo(); ?>

then look for the the odbc extension.

Update:
Some users also reported that the Zend server came with an older version of the MSSQL drivers that had to be removed before installing the extension.

Feedback and Knowledge Base