I am trying to connect to PHP from an MSSQL database and a very disappointing while trying to connect I'm experiencing an error. This message loads for one minute before printing the following message:
Fatal error: 'Exception' with message 'SQLSTATE [08001]' PDOException ': [Microsoft] [SQL Server Native] Client 11.0] Named Pipes Provider: Connection to SQL Server can not be opened [53]. Here is my connection string:
DB :: configuration ("sqlsrv: server = {$ dbHost}; database = {$ dbName}", $ DbUser, $ dbPass); and in my DB class:
public static function configuration ($ dsn, $ user, $ pass) {self :: $ _ pdo = @ New pdo ($ DSN, $ user, $ pass); ... // Deliberately left out I am very surprised I have the following modules configured in the php.ini file: extension = php_pdo_sqlsrv_54_ts.dll. Although I think I have installed it correctly and I have not received an error message about which the driver is not working, this bit of PHP does not print anything:
If (function_exists ('sqlsrv_connect')) O "; And as you can see from my error message above SQL Server Native Client 11, that works. On the platform, I tried to take no advantage of the firewall I do not have much information about SQL Server or I will share it here.
This is my first posting on the stack, so I apologize if I am leaving important part of the information or I In any way, I am not following the proper etiquette, but any help is definitely appreciated.
In addition, I should add that I already googling too much Do it Or, I have not had any success.
My installation process really works, but Connection was really invalid. I should have used the IP address as the host name, which I was not. I was using a colon instead of a comma before the port number. In the end, no space allowed in the connection string, which I thought would be automatically snatched. So, for you, there is a valid connection string for those who can find themselves in the same situation: "connectionString =" sqlsrv: server = 123.123.12.1,9864; database = MssqldatabaseWootWoot "; In addition, in response to my previous observation about that function sqlsrv_connect, I did not enable the required driver for that function. It is located in php_sqlsrv_54_ts.dll, after enabling, the function is reported as current. Anyone who puts a time in solving this, thanks.
No comments:
Post a Comment