We help IT Professionals succeed at work.

PHP can't connect to SQL Server

Warning: mssql_connect() [function.mssql-connect]: message: Login failed for user 'mark'. (severity 14)

It's able to find the server because if it can't find the server then it crashes at that point.  So now I'm just having a problem loging into sql-server that is running on the same machine.   I tried two different logins.  I tried making apache with services login.  before that I tried creating a user and password both 'mark'  in SQL Server.  That didn't work either.

I'm using apache
$server = 'REBOOTMY-XXXX\SQLEXPRESS';  //Your server name will be here

// Connect to MSSQL
//$link = mssql_connect($server, 'mark', 'mark');
$link = mssql_connect($server, '.\apache', 'lucy51');

Open in new window

Watch Question

Maybe a misconfiguration or need a driver update in your PHP installation
For SqlServer 2005/2008 you may need to use a different extension (php_sqlsrv.dll).



I figured it out. I was able to get past the log on error by going into Management studio
In case anyone else brings this up searching for the same thing here's what I did:

Go to Object Explorer (The folders in the left column)
click the root node (Looks like a silinder with a green circle with an arrow inside)
choose  Properties
Go to Select a page (left column in the Server Properties)
Click Security
under Server Authentication
click SQL Server and Windows Authentication mode

And that fixed my problem with that.  I kept coming across things making me think it wasn't possible although I still have to figure out how to get the data out.  But at least I'm connected


I didn't actually figure it out though I found the solution on youTube:
so Thanks goes to viperz1331 on youtube


Explore More ContentExplore courses, solutions, and other research materials related to this topic.