[英]Unable to connect to my mssql database using PHP
我看到另一個用戶有一個類似的問題: 為什么我不能使用PHP連接到我的mssql數據庫?
我收到相同的錯誤。
Array
(
[0] => Array
(
[0] => 28000
[SQLSTATE] => 28000
[1] => 18456
[code] => 18456
[2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'userName'.
[message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'userName'.
)
[1] => Array
(
[0] => 42000
[SQLSTATE] => 42000
[1] => 4060
[code] => 4060
[2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "DBname" requested by the login. The login failed.
[message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "DBname" requested by the login. The login failed.
)
[2] => Array
(
[0] => 28000
[SQLSTATE] => 28000
[1] => 18456
[code] => 18456
[2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'userName'.
[message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'userName'.
)
[3] => Array
(
[0] => 42000
[SQLSTATE] => 42000
[1] => 4060
[code] => 4060
[2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "DBname" requested by the login. The login failed.
[message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "DBname" requested by the login. The login failed.
)
)
我已成功為頁面顯示phpinfo()
。
我找不到我的php.ini文件。 它應該位於C:\\Program Files (x86)\\PHP\\v5.3\\php.ini
但我沒有看到它。
任何幫助將非常感激。
從錯誤消息中,我認為該連接有效,但您的憑據無效。 使用userName作為用戶名和DBname作為數據庫名稱真的正確嗎 ? 看起來您那里有復制/粘貼問題。
關於ini文件:您應該在phpinfo輸出中看到它,搜索Loaded Configuration File 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.