简体   繁体   中英

Connexion problem with phpGrid-Lite with MS-SQL-Server with PHP 7.3

Someone is using phpGrib with PHP 7.3 and MS-SQL-Sever ? If yes I have a problem maybe someone can save me. I have this error :

{ 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 }

I already looked at this page https://phpgrid.uservoice.com/knowledgebase/articles/314967-undefined-constant-odbc-binmode-return-and-sql-cur which was useless because I already have driver for PHP7.3 and MS-SQL-Server as I connected to database with PDO, I uninstall, install again driver and it change nothing (of course I reset Apache)

here the code I put as recommend by phpGrid :

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');

I have string instead of ### which are here just for mask data Also when I connect to database by PDO without phpGrid I have no problem, then I tried to change

define('PHPGRID_DB_TYPE', 'odbc_mssql_native');

by

define('PHPGRID_DB_TYPE', 'sqlsrv');

then I have the 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

Look like it take sqlsrv like mysql.

Then I try

define('PHPGRID_DB_TYPE', 'mssqlnative');

Because it's working with adodb and cautious this time I have the super usefull error :

Error: Could not connect to the database

Someone have an idea or the solution ? I don't have other idea exept have to do all DataGrid myself :( but will be much longer.

First you should check that you have the latest version of the following drivers installed on your server :

ODBC driver (v17) from Microsoft:

https://www.microsoft.com/en-us/download/details.aspx?id=56567

SQLSRV v5.50 for PHP 7.3. It's only a preview (but official) 5.50 version:

https://github.com/Microsoft/msphpsql/releases/tag/v5.5.0-preview

Note that the way of calling extensions has changed in PHP7.3. You then have to enable both .DLL in your php.ini with these precise names :

extension=pdo_sqlsrv_73_ts_x64
extension=sqlsrv_73_ts_x64

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM