简体   繁体   English

2个相同的apache / php安装从同一个SQL Server数据库返回不同的结果

[英]2 identical installations of apache/php return different results from the same SQL Server database

I wrote the code on my development machine WinXPsp3, which has apache standalone 2.2.21. 我在我的开发机器WinXPsp3上编写了代码,该机器具有独立的apache 2.2.21。 The query worked fine. 查询工作正常。

I then copied the php over my production machine WinXPsp3, which had apache 2.2 windows installation with php 5.3.5 windows installation, and is the SQL Server machine, but the query crashed. 然后我将php复制到我的生产机器WinXPsp3上,它安装了apache 2.2 windows,安装了php 5.3.5 windows,并且是SQL Server机器,但是查询崩溃了。

I uninstalled apache and php on the production machine and copied my stand-alone version over from the development machine, but when I started apache, I got an error that MSCPV100.dll was missing. 我在生产机器上卸载了apache和php,并从开发机器上复制了我的独立版本,但是当我启动apache时,我收到了MSCPV100.dll丢失的错误。 I installed MS C++ Redist, and that problem went away. 我安装了MS C ++ Redist,这个问题就消失了。

The query is as follows: 查询如下:

SELECT TOP (50) 
    [ID], 
    (SELECT Case 
    WHEN [Location] is null then 'Unknown' 
    WHEN [Location]='' THEN 'Unknown' 
    ELSE UPPER([Location]) END
     + ', ' as [text()] FROM dbo.[OtherTable] 
    WHERE [OtherTable].[Key]=[Table].[ID] FOR XML path('')) AS Locations 
    FROM Table

(any mis-formatting here is not reflective of my actual query, as it works on other apache installations) (这里的任何错误格式都不能反映我的实际查询,因为它适用于其他apache安装)

The query is choking on the lower-case "AS" before [text()] with "Incorrect Syntax near the Keyword 'as'". 查询在[text()]之前的小写“AS”上窒息,“关键字附近的语法不正确”为“”。

The query was originally in uppercase, and had many more fields, so I used lower case until I found out which "AS" the failure description was talking about. 该查询最初是大写的,并且有更多的字段,所以我使用小写,直到我发现故障描述所讨论的“AS”。

I tried replacing the "[]" around text() with "''", but that didn't help. 我尝试用“''”替换text()周围的“[]”,但这没有帮助。

The facts I know to be true: 我知道的事实是真的:

  • The apache installations are identical. apache安装是相同的。

  • The php installations are identical. php安装是完全相同的。

  • The query works fine when hosted through the identical installation 通过相同的安装托管时,查询工作正常
    of apache on a different machine. 在另一台机器上的apache。

  • Other queries are working fine on the production machine after the 其他查询在生产机器上运行正常
    apache/php upgrade. apache / php升级。

This information leads me to believe that there's something awry with the production machine, and not apache, sql server, php, or the query. 这些信息让我相信生产机器存在一些问题,而不是apache,sql server,php或查询。 Any ideas as to what that might be? 关于那可能是什么的任何想法?

A couple of things I didn't mention: 我没有提到的几件事:

The PHP connection type is odbc. PHP连接类型是odbc。

The SQL Server ODBC drivers on both machines are 2000.85.1132.0, but the production machine also has SQL Server Native Client 10.0 version 2007.100.2531.00. 两台计算机上的SQL Server ODBC驱动程序均为2000.85.1132.0,但生产计算机还具有SQL Server Native Client 10.0版本2007.100.2531.00。

Ok, I pulled a snafu - I was "endode"ing the plus sign on one server, while I was "encodeURIComponent"ing on the other. 好吧,我拉了一个snafu - 我在一台服务器上“加号”加号,而我是另一个“encodeURIComponent”。 So much for copy/paste - my bad. 这么多的复制/粘贴 - 我的坏。 Thanks for looking anyway! 无论如何,谢谢你!

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

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