Page 1 of 1

MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 31 Jan 2012, 16:59
by AddedValue
Windows Server 2008 R2:
Installed IIS 7.5 - check "CGI" feature
Installed PHP 5.3.9 (or 5.3.10)
Installed PHP Manager for IIS (codeplex site, x86 or x64!)
Installed SQL Server 2008 R2 (enable .NET Framework Core role via Add Features .NET 3.5.1)
Installed MSSQL drivers for PHP (SQLSRV20) (SQLSRV30 doesn't work with me)
Enabled those drivers with PHP Manager for IIS (Visible in IIS Manager)
Extracted Mantis files to wwwroot
Created a Mantis Database called Mantis on SQL Server 2008 R2 with the added .sql file (rename)
Create a database user and hook it up to the database (with read/write) rights

Not needed, check out one of the newer posts in this topic to use SQL access without ODBC.
Created a System DSN entry with the 32bit ODBC console (SysWOW64 folder) called MantisDSN
Changed the database section of config_inc.php to point to the odbc entry:

# --- Database Configuration ---
$g_hostname = 'MantisDSN';
$g_db_username = 'dbuserwithmantisaccess';
$g_db_password = 'passwordofdbuserwithmantisaccess';
$g_database_name = 'mantis';
$g_db_type = 'odbc_mssql';

Empty browser cache from previous failed attempts
Browse to http://localhost/mantis (your equivalent)

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 01 Feb 2012, 11:34
by AddedValue
Just for convenience:
SQL Server 2008 R2 with Management Tools: http://go.microsoft.com/fwlink/?LinkId= ... lcid=0x409
PHP Manager for IIS x64: http://phpmanager.codeplex.com/releases ... oad/253209
SQL Server drivers for PHP: http://www.microsoft.com/download/en/de ... x?id=17308

Don't forget enable (local) database users (the Mantis user) in SQL Server Management Studio.
Use the odbcad.exe in the SysWoW64 folder to create a 32bit ODBC SystemDSN for PHP.

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 06 Feb 2012, 18:00
by Hockeytown
I followed these steps in our test environment and it setup nicely but is throwing the following error once logged in and Clicking the Summary tab:

APPLICATION ERROR #401

Database query failed. Error received from database was #0: [Microsoft][ODBC SQL Server Driver]Invalid parameter number for the query: SELECT b.id, b.date_submitted, b.last_updated, MAX(h.date_modified) as hist_update, b.status
FROM mantis_bug_table b LEFT JOIN mantis_bug_history_table h
ON b.id = h.bug_id AND h.type=0 AND h.field_name='status' AND h.new_value=?
WHERE b.status >=? AND 1<>1
GROUP BY b.id, b.status, b.date_submitted, b.last_updated
ORDER BY b.id ASC.

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

Looks like the Date/Time issue with PHP and MSSQL. Any help on getting this resolved would be appreciated.

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 07 Feb 2012, 15:31
by AddedValue
Needed a few more steps and some (backporting from 1.3.0) to fix:
The three files (attachments) need to be added to the "core" directory in Mantis (fixing some SQL statements).

We need the SQLSRV20 driver http://www.microsoft.com/download/en/de ... x?id=20098 from Microsoft if we want true mssqlnative to work, without odbc hack.
Extract to "C:\Program Files (x86)\PHP\ext" or something similar (use elevated privileges, eg run as administrator).
Ofcourse you'll need to enable the files with the PHP Manager for IIS (and disable the other ones).

To adjust the settings we can actually fix the 'config_inc.php' when adding the following:
# --- Database Configuration ---
$g_hostname = 'sqlserver\database';
$g_db_username = 'mantisdbuser';
$g_db_password = 'mantisdbuserpassword';
$g_database_name = 'mantis';
$g_db_type = 'mssqlnative';

And you can ditch the odbc dsn entry now :)

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 07 Feb 2012, 16:36
by Hockeytown
Using this format $g_hostname = 'sqlserver\database'; gave me this error:
APPLICATION ERROR #400

Database connection failed. Error received from database was #-1: SQLState: 08001
Error Code: -1
Message: [Microsoft][SQL Server Native Client 10.0]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
SQLState: HYT00
Error Code: 0
Message: [Microsoft][SQL Server Native Client 10.0]Login timeout expired
SQLState: 08001
Error Code: -1
Message: [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
SQLState: 08001
Error Code: -1
Message: [Microsoft][SQL Server Native Client 10.0]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
SQLState: HYT00
Error Code: 0
Message: [Microsoft][SQL Server Native Client 10.0]Login timeout expired
SQLState: 08001
Error Code: -1
Message: [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.


Changing to this format $g_hostname = 'sqlserver'; I am facing this error:
APPLICATION ERROR #400

Database connection failed. Error received from database was #18456: SQLState: 28000
Error Code: 18456
Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'mantisbt'.
SQLState: 28000
Error Code: 18456
Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'mantisbt'.
SQLState: 28000
Error Code: 18456
Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'mantisbt'.
SQLState: 28000
Error Code: 18456
Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Login failed for user 'mantisbt'.


mantisbt is the SQL user I created and granted it DBO rights to the MantisBT DB I created in MSSQL and it was working before.

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 07 Feb 2012, 16:50
by AddedValue
What client protocols do you have enabled in SQL Native Client 10.0 Configuration in the Sql Server Configuration Manager.

Well, I believe the new files should work with the ODBC connection as well (the files just fix some SQL statements).

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 07 Feb 2012, 17:37
by Hockeytown
Attached is a snapshot of the Protocols enabled on the SQL Native Client 10.0 Configuration

I also tried reverting back to the ODBC and DSN setup and got the same results as before the 3 new files were added.

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 07 Feb 2012, 18:09
by Hockeytown
Ahem.... What I am about to do is very painful. Your fix works just fine it's my brain that may need some work. I was trying to connect to the wrong SQL DB.... DOH!! 8O After I caught my mistake and changed it things are working and testing can begin.

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 08 Feb 2012, 08:15
by AddedValue
Happy to know that you made it work as well!
I might have skipped some small steps in my small how-to but glad to know you made it work as well.

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 08 Feb 2012, 17:30
by Hockeytown
So testing has begun and after creating a test issue to report and assigning it when clicking on the bug link, either from email or directly inside Mantis the following error is thrown:

APPLICATION ERROR #401
Database query failed. Error received from database was #102: SQLState: 42000
Error Code: 102
Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near ')'.
for the query: SELECT id, name, description FROM mantis_tag_table WHERE id IN ( ) ORDER BY name ASC .

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 09 Feb 2012, 08:54
by AddedValue
It it an URL in the likes of:
http://localhost/mantis/view.php?id=3

If that is the case, I can't reproduce it in my setup.

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 27 Feb 2012, 17:43
by Hockeytown
What can I get you to help troubleshoot this error? Seems to be an issue with the SQL query:
SELECT id, name, description FROM mantis_tag_table WHERE id IN ( ) ORDER BY name ASC

What is supposed to be happening in the part of the query I have highlighted above?

Re: MSSQL2008R2/IIS7.5/PHP5.3.9 Working

Posted: 06 Mar 2012, 15:24
by Hockeytown
Can anyone help out with this?