简体   繁体   English

无法将Linux XAMPP PHP连接到SQL Server数据库

[英]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. 我在Ubuntu 9.1上使用XAMPP 1.7.3a。

I have used the methods found at http://www.webcheatsheet.com/PHP/connect_mssql_database.php , they all fail. 我已经使用了在http://www.webcheatsheet.com/PHP/connect_mssql_database.php上找到的方法,但它们都失败了。 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. 我可以通过MS Access与连接的数据库“连接”,但这不是可接受的解决方案,因为并非所有用户都可以使用Access。

The first method (at webcheatsheet) uses mssql_connect, et.al. 第一种方法(在webcheatsheet中)使用mssql_connect等。 but I get this error from the mssql_connect() call: 但我从mssql_connect()调用中收到此错误:

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: [my server] in [my code] 警告:mssql_connect()[function.mssql-connect]:无法连接到服务器: [我的代码]中的 [我的服务器 ]

[my server] is the server address, I have used both the host name and the IP address. [我的服务器]是服务器地址,我同时使用了主机名和IP地址。
[my code] is a reference to the file and line number in my .php file. [我的代码]是对.php文件中文件和行号的引用。

Is there a log file somewhere that would have more information about the failure, both on my machine and SQL Server? 我的计算机和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. 我们没有真正的DBA,因此,如果问题似乎出在服务器端,我将需要特定的信息来传递。

All assistance is appreciated, including RTM when the location of the M is provided! 感谢所有协助,包括提供M位置时的RTM! Thanks 谢谢

Are you sure you are running a MS SQL server? 您确定您正在运行MS SQL服务器吗? As far as I am aware, the XAMPP packages comes with a MySQL server. 据我所知,XAMPP软件包是MySQL服务器附带的。 Try and use mysqli_connect() with the same parameters. 尝试使用具有相同参数的mysqli_connect()

Can you show us how you used mssql_connect? 您能告诉我们您如何使用mssql_connect吗?

Btw, I would use the PHP driver offered by Microsoft to allow PHP to connect Microsoft SQL Server. 顺便说一句,我将使用Microsoft提供的PHP驱动程序来允许PHP连接Microsoft SQL Server。

断开网络连接后,我发现PHP尝试在端口4000而不是1433上连接到SQL Server。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM