0
votes

I have a very strange behavior with my newly installed SQL Server 2016. I was able to get PHP 7 to work on IIS 8.5 and also properly setup PHP for the SQL Server 2016 that is installed on a Windows 2016 Web Server.

I logged in with SA on the SQL Server and created a local SQL account to use with Wordpress. During testing, I am able to login to the SQL Server from the Management Studio and navigate into the Wordpress Database that I created and assigned the user to as DBO. I also set the user's permission on the SQL Server as guest on both master and the whole Website.

Now, Testing PHP, I am able to use my SA account to query the databases and generated records; however, when I switch to the local user account, I am getting the following error:

Array ( [0] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'wpuser'. [message] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'wpuser'. ) [1] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'wpuser'. [message] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 'wpuser'. ) )

The User was created with the SQL and Windows Authentication Mode enabled and have been allowed Read access to all the databases on the Server but DBO to the Wordpress database. I can login to the database from Management Studio with this user account and browse the databases and run queries on the Wordpress database. I am unable to use the user from a Web query.

Has anyone encounter this issue and know how to solve it? I am stumped...

Thank you for your support.

1

1 Answers

0
votes

While reading some posts at the Microsoft PHP Blog, there was a mention of using curly braces in a password that needed to be escaped with a second brace, such as this Pa{sword => Pa{{sword to allow success. In my case, I was using the $ in my user password and that did not work for the Web page PHP Database credentials. Once I realized this issue, I changed the $ to another special character and the login was successful.