Mssql Iis6 [英] Mssql Iis6

查看:77
本文介绍了Mssql Iis6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我是PHP的新手,我遇到了以下几个问题...


我已经在运行IIS 6(W2k3)并托管多个站点的服务器1上成功安装了PHP ,其中一些连接到服务器2上的MSSQL 2k(SP4)(使用ASP)。


我可以在server1上加载一个基本的Hellow worldPHP页面,但是当我添加代码以创建与服务器2上的MSSQL的简单连接,我的PHP似乎无法连接或输出任何所需的查询结果到屏幕(例如表中的行数)。我在这个页面中放置了3个echo语句,以便查看正在处理的内容,因为我没有关于故障可能位于何处的其他信息。我在哪里可以找到PHP错误日志?


echo1,出现在php脚本的开头,可以很好地写入屏幕。


echo2,它出现在MSSQL连接变量定义之后,不会写入屏幕。


echo2,它出现在MSSQL查询结果写入屏幕后,不会写入屏幕(也不查询结果)。


我使用的PHP脚本如下:

<?php

echo''< p>第1行< / p>'';


$ con = mssql_connect(''MSSQLINSTANCE'',''username'',''password'')或死亡(连接失败);


echo''< p>第2行< / p>'';


mssql_select_db(''DATABASENAME'',$ con);

$ sql =''SELECT * FROM sys.tables'';

if($ res = mssql_query($ sql,$ con)){

print(mssql_num_rows($ res)。database.\ n中的表格);

} else {

print(" SQL failed.\\\
) );

}

mssql_close($ con);


echo''< p>第3行< / p>'';


?>



显然,上面的CAPS中的值将替换为服务器2上的MSSQL实例的适当值,管理员用户名,管理员密码和数据库名称。


我已经按照我在网上找到的所有手册,讨论板和说明,仍然没有快乐。我已在MSSQL服务器上命名管道和TCP / IP。我还解决了ntwdblib.dll文件版本的问题,通过从SQLserver复制到server1上的PHP目录和system32目录。


除了上面的问题,还有尽可能追溯,我无法在server1上加载文件phpinfo.php。我想我首先需要在解决MSSQL连接问题之前解决这个问题。


phpinfo.php文件如下所示:

< ;?

phpinfo();

?>



所有建议都表示赞赏。在此先感谢

Hi. I''m a newbie to PHP and am having a few problems as follows...

I have installed PHP successfully on server 1 which is running IIS 6 (W2k3) and hosting multiple sites, some of which connect to MSSQL 2k (SP4) on server 2 (using ASP).

I can load a basic ''Hellow world'' PHP page hosted on server1 but when I add the code to create a simple connection to MSSQL on server 2, my PHP doesn''t seem to connect nor output any of the desired query results to screen (e.g. number of rows in a table). I have placed 3 echo statements in amongst this page in order to see what is being processed successfuly as I have no other information as to where the failure may lie. Where can I find PHP error logs?

echo1, which appears at the start of the php script, writes to the screen fine.

echo2, which appears immediately after the MSSQL connection variable definition, does not write to the screen.

echo2, which appears after the MSSQL query results are to be written to the screen, does not write to the screen (nor do the query results).

The PHP script I am using is as follows:

<?php
echo ''<p>line 1</p>'';

$con = mssql_connect(''MSSQLINSTANCE'',''username'',''password '') or die("Connection failed");

echo ''<p>line 2</p>'';

mssql_select_db(''DATABASENAME'', $con);
$sql = ''SELECT * FROM sys.tables'';
if ($res = mssql_query($sql, $con)) {
print(mssql_num_rows($res) . " tables in database.\n");
} else {
print("SQL failed.\n");
}
mssql_close($con);

echo ''<p>line 3</p>'';

?>


Obviously, the values in CAPS above are replaced with the appropriate values for the MSSQL instance on server 2, administrator username, administrator password, and db name.

I have followed all the manuals, discussion boards and instructions I can find on the net and still no joy. I have named pipes and TCP/IP enabled on the MSSQL server. I have also addressed the issue of the ntwdblib.dll file version, by copying from the SQLserver across to the PHP directory and system32 directory on server1.

In addition to the problem above, and tracking back as far as I can, I am unable to get the file phpinfo.php to load on server1. I guess that I first of all need to solve this problem before tackling the MSSQL connection issue.

The phpinfo.php file reads a follows:

<?
phpinfo();
?>


All advice appreciated. Thanks in advance

推荐答案

con = mssql_connect(''MSSQLINSTANCE'',''username'',''password'')或死亡(连接失败) );


echo''< p>第2行< / p>'';


mssql_select_db('''DATABASENAME'',
con = mssql_connect(''MSSQLINSTANCE'',''username'',''password '') or die("Connection failed");

echo ''<p>line 2</p>'';

mssql_select_db(''DATABASENAME'',


con);
con);


sql =''SELECT * FROM sys.tables'';

if(
sql = ''SELECT * FROM sys.tables'';
if (


这篇关于Mssql Iis6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆