You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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_TYPE to '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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 09:21:22