Connection to sqlsrv
string not working.
$login = new PDO("sqlsrv:server=MYSQLSERVER\SQLEXPRESS;Database=db_name", "user", "passw");
And i have error message: Fatal error: Invalid handle returned
.
I'm 101% sure that login details is OK. Because it works on other projects. Could be a problem PHP 7
?
Try "ConnectionPooling=0" in DSN.
sometimes working and sometimes return error
It might be a problem on re-using connection.
DSN Reference: https://msdn.microsoft.com/en-us/library/ff628167(v=sql.105).aspx
There's a problem with PHP Sql Server driver
You should update it to new version
As you mentioned you are using windows, this version is fully working on windows
https://github.com/Microsoft/msphpsql/releases/tag/v4.1.1-Windows
Looks like to connect to MS-SQL, you will need to utilize ODBC.
Reference: http://php.net/manual/en/pdo.construct.php#120705
$odbc="odbc:Driver={SQL Server};Server=$server;Database=$database;";
$cnx = new PDO( $odbc , $user, $password);
i updated windows php 7 drivers
and solved:)
https://github.com/microsoft/msphpsql/releases/tag/v4.1.1-Windows
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.