简体   繁体   English

执行mssql_query函数时,简单的PHP脚本将停止执行且没有错误

[英]Simple PHP script stops executing with no error while executing mssql_query function

I have this simple PHP script, which is calling a MSSQL db procedure: 我有这个简单的PHP脚本,它正在调用MSSQL db过程:

<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);

mssql_connect('server', 'user', 'pass');
mssql_select_db('dbname');

if(mssql_query(' exec dbo.SomeProcedure '))
    echo "OK\n";
else
    echo "FAIL\n";

When trying to call the script from web browser, I receive a "connection reset" message. 尝试从Web浏览器调用脚本时,我收到“连接重置”消息。 When trying to call it from command line, no echo command is executed. 当尝试从命令行调用它时,不执行任何echo命令。 It just fails on line with mssql_query call. 它只是与mssql_query调用联机失败。

No error message is displayed, or saved to php error log (defined in virtualhost). 不显示任何错误消息,或将其保存到php错误日志(在virtualhost中定义)。 The strange thing is, that if I call another procedure within the same PHP script, it works fine. 奇怪的是,如果我在相同的PHP脚本中调用另一个过程,则可以正常工作。 And if I call the same procedure (under the same user) directly in database, it also works fine (no error raised). 而且,如果我直接在数据库中调用同一过程(在同一用户下),它也可以正常工作(不会引发错误)。

No additional error handling is implemented, the mentioned piece of code is the whole content of my script. 没有实现其他错误处理,提到的代码段是我脚本的全部内容。

Can someone, please, give me a advice, how to debug/find out, what is gone wrong? 有人可以给我建议,如何调试/查找问题,出了什么问题?

PHP version : PHP 5.3.3-7+squeeze25 with Suhosin-Patch (cli) PHP版本 :具有Suhosin-Patch的PHP 5.3.3-7 + squeeze25(cli)
MSSQL driver : freetds MSSQL驱动程序 :freetds

It just fails on line with mssql_query call. 它只是与mssql_query调用联机失败。

This means either error is before if or i the call . 这意味着在if或i之前发生错误。

I receive a "connection reset" message. 我收到“连接重置”消息。

Probably means that there is an error in connection like database name or pass, etc . 可能意味着连接中有错误,例如数据库名称或pass等。 So make sure the parameters in connection establishing line are correct 因此,请确保连接建立线中的参数正确

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

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