PHP/SQLServer/MySQL

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
sfsit
Posts: 4
Joined: 22 May 2018, 18:59

PHP/SQLServer/MySQL

Post by sfsit »

I use Mantis on a PHP/SQL Server platform. This server also contains MySQL. I upgraded MySQL 8.0 and changed IIS to use PHP 7.1; I didn't think this would have mattered to Mantis. I'm now receiving APPLICATION ERROR #400
Database connection failed. Error received from database was #0: PHP Support for database is not enabled.


Currently at Mantis v2.6.0. It doesn't appear that upgrading to the latest version would make a difference. Any assistance is appreciated.
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: PHP/SQLServer/MySQL

Post by atrol »

I assume you have set $g_db_type to "mysql".
If so, change it to "mysqli" as the "mysql" driver is no longer supported in newer PHP version.

Independent from that, I recommend to upgrade Mantis to latest stable version, as 2.6.0 is quite outdated and comes with some major security issues.
Please use Search before posting and read the Manual
sfsit
Posts: 4
Joined: 22 May 2018, 18:59

Re: PHP/SQLServer/MySQL

Post by sfsit »

Thank you for your reply, I'm actually using SQL Server ($g_db_type = 'mssqlnative') so the upgrade of MySQL should not have affected Bug Tracker - yet this error is occurring. I'm wondering if there's anything related to PHP which would cause the issue. I plan to update, but I'd prefer updating when I have a stable environment if possible. Thank you.
obmsch
Posts: 26
Joined: 26 Mar 2013, 22:19

Re: PHP/SQLServer/MySQL

Post by obmsch »

changed IIS to use PHP 7.1
...
Database connection failed. Error received from database was #0: PHP Support for database is not enabled
Have you installed/enabled the appropriate driver (extension) in php? For recent releases:
https://github.com/Microsoft/msphpsql/releases
Make sure the prerequisites are met too (ODBC Driver). If in doubt, follow the readme on github.
sfsit
Posts: 4
Joined: 22 May 2018, 18:59

Re: PHP/SQLServer/MySQL

Post by sfsit »

I temporarily tabled this problem and went back to PHP 5.3. Now it's necessary for me to move to PHP7.1 and I still have this issue. I am "in Process" on upgrading to Mantis 2.18.
Here's an update.
My PHP/MySQL websites running under IIS (Server 2012R2) are fine. I'm having an issue with Mantis (PHP 7.1/SQLServer 2014SP2). I'm currently using php_pdo_sqlsrv.dll/php_sqlsrv.dll v5.3 under PHP v7.1 (all x86). I have ODBC Driver 17 (x86 and x64) installed on the server which should work. Mantis gives a Open Connect fail message when executing check/index.php with the following message: APPLICATION ERROR #400: Database connection failed. Error received from database was #0: SQLState: IM004 Error Code: 0 Message: [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed SQLState: IM004 Error Code: 0 Message: [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed.
Raised in file D:\InetPub\wwwroot\MantisBT\core\database_api.php on line 165

Any suggestions on my next course of action? Thank you!
obmsch
Posts: 26
Joined: 26 Mar 2013, 22:19

Re: PHP/SQLServer/MySQL

Post by obmsch »

Looks like a start up issue with SQL Server Agent. Please check

a) The SQL Server ERRORLOG and if present the SQLAgent.out file
b) The windows event log (both application and system), if there are any entries around the time your error occurred

That might reveal enough information about the exact cause of this issue.

Martin
sfsit
Posts: 4
Joined: 22 May 2018, 18:59

Re: PHP/SQLServer/MySQL

Post by sfsit »

Thank you for your reply and your time. I was able to resolve the issue. Although the ODBC,SQL and Windows event logs didn't reveal anything, I was able to toggle between PHP versions and through this process, I found that my PHP SQL extension wasn't correct. I downloaded the proper version and it's working properly.
Post Reply