PHP7.3环境下phpGrid-Lite连接MS SQL Server报错求助
PHP 7.3 + phpGrid-Lite: Undefined Constants Error When Connecting to MS SQL Server
I’m stuck trying to get phpGrid-Lite connected to MS SQL Server in my PHP 7.3 environment and could really use some help from folks who’ve dealt with this setup before.
Current Error (Using odbc_mssql_native as DB Type)
Warning: Use of undefined constant ODBC_BINMODE_RETURN - assumed 'ODBC_BINMODE_RETURN' (this will throw an Error in a future version of PHP) in C:\Apache24\localhost***\phpGrid_Lite\server\adodb5\adodb.inc.php on line 4771 Warning: Use of undefined constant SQL_CUR_USE_DRIVER - assumed 'SQL_CUR_USE_DRIVER' (this will throw an Error in a future version of PHP) in C:\Apache24\localhost***\phpGrid_Lite\server\adodb5\adodb.inc.php on line 4771
What I’ve Already Tried
- I referenced the official phpGrid knowledge base article about these undefined constants, but it didn’t resolve the issue.
- I’ve installed the correct MS SQL Server drivers for PHP 7.3, and can connect to the database successfully using PDO directly—so the driver setup itself works.
- Uninstalled and reinstalled the drivers, then restarted Apache multiple times—no change in the error.
My phpGrid Configuration Code
define('PHPGRID_DB_HOSTNAME','localhost'); // database host name define('PHPGRID_DB_USERNAME', '###'); // database user name define('PHPGRID_DB_PASSWORD', '###'); // database password define('PHPGRID_DB_NAME', '###'); // database name define('PHPGRID_DB_TYPE', 'odbc_mssql_native'); // database type define('PHPGRID_DB_CHARSET','utf8');
Note: ### masks valid, sensitive credentials.
Failed Attempts with Other DB Types
- When switching
PHPGRID_DB_TYPEto'sqlsrv', phpGrid incorrectly tries to use the MySQL driver, throwing this error:
Warning: mysqli_real_connect(): (HY000/2002): No connection could be made because the target machine actively refused it. in C:\Apache24\localhost***\phpGrid_Lite\server\adodb5\drivers\adodb-mysqli.inc.php on line 124 Error: Could not connect to the database
- Using
'mssqlnative'only returns a generic:
Error: Could not connect to the database
I’m out of troubleshooting ideas—building a custom DataGrid would take way too long for my deadline. Any advice or solutions would be a huge help!
内容的提问来源于stack exchange,提问作者user10989117
相关产品推荐
相关产品推荐

