Skip to content

sqlsrv connection issues via browser - error: "There is some problem in connection: SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver for SQL Server" #799

@leepolanco

Description

@leepolanco

Hello, i need help on identifying what i am missing on this setup.
I need to connect MSSQL server via php/apache/linux setup.
Connections works fine CLI (php mytest_connect_script.php) , however not from browser.

-----details----
+## PHP Driver version or file name
Array
(
[0] => odbc
[1] => sqlite
[2] => mysql
[3] => sqlsrv
)
+## SQL Server version
Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64)
+## Client operating system
Red Hat Enterprise Linux Server release 7.3 (Maipo)
+## PHP version
7.2
+## Microsoft ODBC Driver version
unixODBC-2.3.1-11 and have /etc/odbcinst.ini with freeTDS as well.
+## Table schema
+
+## Problem description
testing connection:
mytest_connect_script.php - works fine from command line (CLI) but it does not on browser (apache)

+## Expected behavior and actual behavior
connected via web browser
+## Repro code or steps to reproduce
//-----------------------
// PDO connection
//-----------------------
class pdo_connection {
protected $con;
public function openConnection(){
try {
$this->con = new PDO("sqlsrv:Server=".DB_HOST.";Database=".DB_NAME, DB_USER, DB_PASS);
return $this->con;
}
catch (PDOException $e) {
echo "There is some problem in connection: " . $e->getMessage();
}
} //end of func

public function closeConnection() {
$this->con = null;
}//end func

} //end of clas

comments:
Any hints on this specific issue will be appriciated.
I have bieng gloogling nothing lead me to good solution.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions