I am connecting to MS SQL server with PDO using sqlsrv driver.
The PHP version is 5.3.24. A working connection is as follows:
$dsny = "sqlsrv:Server=xx1;Database=xx2"; $usery = 'xx3'; $passwordy = 'xx4'; $dbhy = new PDO($dsny, $usery, $passwordy);
**
But I need to set the characters, and then I will try the following:
$dsny = "sqlsrv:Server=xx1;Database=xx2;charset=utf8"; $usery = 'xx3'; $passwordy = 'xx4'; $dbhy = new PDO($dsny, $usery, $passwordy);
When I add charset, I get this error: "Fatal error: exception thrown" PDFException "with the message" SQLSTATE [IMSSP]: invalid keyword "charset" was specified in dsn string "
So what can cause this error?
From what I read, I need to do this since I am launching a new version of PHP.
Niels source share