Linux上的PHP随机无法连接到Microsoft SQL Server 2005

时间:2022-10-20 18:21:17

(Not a Linux guru!) At work we have for the past month had a serious issue that we haven't been able to solve. From a server running Ubuntu-Linux we are using PHP to connect to a server running Microsoft SQL Server 2005. This has been working without problems for a long time. At the start of February 2013 we moved the SQL Server machine into the same core network as the Linux-machine, which involved changing IP-address on the Windows-server running SQL Server 2005.

(不是Linux大师!)在过去的一个月里,我们工作中遇到了一个我们无法解决的严重问题。从运行Ubuntu-Linux的服务器,我们使用PHP连接到运行Microsoft SQL Server 2005的服务器。长期以来,这一直没有问题。在2013年2月初,我们将SQL Server计算机移动到与Linux计算机相同的核心网络,其中涉及在运行SQL Server 2005的Windows服务器上更改IP地址。

After this operation we've had issues connecting to the SQL Server from this particular Linux-machine. Maybe one out of 1000 connections fails with the following error message:

在此操作之后,我们遇到了从这个特定的Linux机器连接到SQL Server的问题。也许1000个连接中有一个失败,并显示以下错误消息:

PHP Warning: mssql_connect(): Unable to connect to server

PHP警告:mssql_connect():无法连接到服务器

I'm not aware of any other changes to either of these two servers. We've tried to look at 'everything'.

我不知道这两个服务器中的任何一个都有任何其他变化。我们试图看看“一切”。

  • FreeTDS
  • php.ini adjustments
  • IP-address in SQL Server Configuration Manager
  • SQL Server配置管理器中的IP地址

  • Unlimited number of concurrent connections in SQL Server
  • SQL Server中无限数量的并发连接

  • Network and firewall issues (No packet loss during 24 hours)
  • 网络和防火墙问题(24小时内没有丢包)

Any suggestions to how we can pursue error searching for this problem? Any more info anyone would like to know about this setup? It's kinda serious for us since many of our cronjobs fail to execute normally due to this random connection problem.

有关我们如何追求错误搜索此问题的任何建议?有关此设置的任何人都想了解更多信息吗?这对我们来说有点严肃,因为由于这种随机连接问题,我们的许多cronjobs都无法正常执行。

Rgds, Sven David, Norway

Rgds,Sven David,挪威

1 个解决方案

#1


1  

Very difficult to diagnose from an external perspective, however, it feels like a networking issue rather than php/sql config. Presumably, because it's intermittent, it's not mssql functions/extension. Very little is truly random!

从外部角度来看很难诊断,但感觉就像网络问题而不是php / sql配置。据推测,因为它是间歇性的,所以它不是mssql函数/扩展。很少是真正的随机!

Perhaps approach this by writing a script that monitors the servers (both hosts) vital stats - like a heartbeat: IPs, DNS, DHCP?, requests etc and setting it to record anomalies/alert you when any element changes on either host or connect requests fail...

也许通过编写监视服务器(两个主机)重要统计数据的脚本来实现这一点 - 如心跳:IP,DNS,DHCP?,请求等,并将其设置为记录异常情况/在主机或连接请求上的任何元素发生更改时提醒您失败...

Probably worth posting on other SE sites too - not just *.

可能也值得在其他SE网站上发布 - 不仅仅是*。

#1


1  

Very difficult to diagnose from an external perspective, however, it feels like a networking issue rather than php/sql config. Presumably, because it's intermittent, it's not mssql functions/extension. Very little is truly random!

从外部角度来看很难诊断,但感觉就像网络问题而不是php / sql配置。据推测,因为它是间歇性的,所以它不是mssql函数/扩展。很少是真正的随机!

Perhaps approach this by writing a script that monitors the servers (both hosts) vital stats - like a heartbeat: IPs, DNS, DHCP?, requests etc and setting it to record anomalies/alert you when any element changes on either host or connect requests fail...

也许通过编写监视服务器(两个主机)重要统计数据的脚本来实现这一点 - 如心跳:IP,DNS,DHCP?,请求等,并将其设置为记录异常情况/在主机或连接请求上的任何元素发生更改时提醒您失败...

Probably worth posting on other SE sites too - not just *.

可能也值得在其他SE网站上发布 - 不仅仅是*。