Cannot connect Linux XAMPP PHP to SQL Server database
I've searched many sites without success. I'm using XAMPP 1.7.3a on Ubuntu 9.1.
I have used the methods found at http://www.webcheatsheet.com/PHP/connect_mssql_database.php, they all fail. I am able to "connect" with a linked database through MS Access, however, that is not an acceptable solution as not all users will have Access.
The first method (at webcheatsheet) uses mssql_connect, et.al. but I get this error from the mssql_connect() call:
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: [my server] in [my code]
[my server] is the server address, I have used both the host name and the IP address.
[my code] is a r开发者_如何学编程eference to the file and line number in my .php file.Is there a log file somewhere that would have more information about the failure, both on my machine and SQL Server? We do not have a bona-fide DBA, so I will need specific information to pass on if the issue seems to be on the server side.
All assistance is appreciated, including RTM when the location of the M is provided! Thanks
Are you sure you are running a MS SQL server? As far as I am aware, the XAMPP packages comes with a MySQL server. Try and use mysqli_connect()
with the same parameters.
Can you show us how you used mssql_connect?
Btw, I would use the PHP driver offered by Microsoft to allow PHP to connect Microsoft SQL Server.
After wiresharking the network connection, I find that PHP is trying to connect to the SQL Server on port 4000 instead of 1433.
精彩评论