-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
Comments
using this : Driver=ODBC Driver 13 for SQL Server |
hi @leepolanco Did you follow every step in our instruction documentation? What's the output when you ran FYI, this is the FAQ which might help. |
Thank you Yitam for getting back to me. but still looking for hints. Output of: odbcinst -q -d -n 'ODBC Driver 13 for SQL Server' |
Hi @leepolanco, something is wrong, but please try the followings: |
Hi @leepolanco, depending on some environment variables, where unixODBC finds Please try doing an strace like this
FYI about strace |
thank you again. |
Hi @leepolanco, you might want to try this in a clean environment. Just a suggestion, of course. So what's the output of |
@leepolanco just thought it's worth trying to run phpinfo() in your browser. Do you have more than one php version installed? Is there more than one php.ini in your env, for example? This link might be useful. |
thank you! fyi: This is test SQLconnection code runs well command line but on not browser! command line: |
No description provided. |
"<?php require_once("../../libs/php/common/sqlsrv_properties.php"); $conn = new PDO("sqlsrv:Server=".DB_HOST.",".DB_PORT.";Database=".DB_NAME, DB_USER, DB_PASS); if( $conn ) ?> |
strace -p 29753 | grep odbcinst.ini |
Hi @leepolanco, I have not been able to reproduce this. I don't have freeTDS in my env however. Can you try this in another setting without freeTDS? Meanwhile I will do some investigation. |
Hi @leepolanco, even with freeTDS installed I have no problem connecting using browser (Apache). Yet, I didn't really configure freeTDS or specify any DSN. That being said, you don't need freeTDS to connect to MS SQL Server. The MS ODBC driver is what the php drivers need to connect to SQL Server. This is another useful reference you might find useful. |
hi @leepolanco , any update? Another user (see issue #805) has experienced a similar issue and managed to find a solution. Please take a look and see if it helps. |
Thank you for following up. |
Updates:
works fine thank you!!! |
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.
The text was updated successfully, but these errors were encountered: