PHP Fatal error: Call to undefined function mssql_connect()(PHP 致命错误:调用未定义函数 mssql_connect())
问题描述
我以前从未使用过 php,我正在尝试连接到运行 IIS7 和 PHP5.3 的 Windows 机器上的 SQL Server 2008 实例.
我已经从 扩展的一部分.您正在使用 microsoft 的扩展,因此请使用 sqlsrv_connect()
,对于 microsoft 驱动程序的 API,请查看 SQLSRV_Help.chm
,它应该被提取到您的 ext
提取扩展时的目录.
I've never used php before and am trying to connect to a SQL Server 2008 instance on a Windows machine running IIS7 and PHP5.3.
I have downloaded and installed SQLSRV30.EXE
from here in C:Program Files (x86)PHPext
added this to C:Program Files (x86)PHPphp.ini
:
extension=php_sqlsrv_53_nts.dll
Then restarted the entire server. I still get fatal errors in my log file saying:
PHP Fatal error: Call to undefined function mssql_connect()
What do I need to do to connect to Microsoft SQL Server 2008 from PHP 5.3 running on IIS7/Windows Server 2008? I'm sure it's something really dumb that I'm missing...
FULL PHPINFO --> http://demo.mandibleweb.com/zapified/hello.php
phpinfo():
PHP Version 5.3.10
System
Windows NT MWD001 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586
Build Date
Feb 2 2012 20:10:58
Compiler
MSVC9 (Visual C++ 2008)
Architecture
x86
Configure Command
cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:php-sdkoracleinstantclient10sdk,shared" "--with-oci8=C:php-sdkoracleinstantclient10sdk,shared" "--with-oci8-11g=C:php-sdkoracleinstantclient11sdk,shared" "--with-enchant=shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet" "--with-mcrypt=static" "--disable-static-analyze"
Server API
CGI/FastCGI
Virtual Directory Support
disabled
Configuration File (php.ini) Path
C:Windows
Loaded Configuration File
C:Program Files (x86)PHPphp.ini
I have just tried to install that extension on my dev server.
First, make sure that the extension is correctly enabled. Your phpinfo()
output doesn't seem complete.
If it is indeed installed properly, your phpinfo()
should have a section that looks like this:
If you do not get that section in your phpinfo()
. Make sure that you are using the right version. There are both non-thread-safe and thread-safe versions of the extension.
Finally, check your extension_dir
setting. By default it's this: extension_dir = "ext"
, for most of the time it works fine, but if it doesn't try: extension_dir = "C:PHPext"
.
===========================================================================
EDIT given new info:
You are using the wrong function. mssql_connect()
is part of the Mssql extension. You are using microsoft's extension, so use sqlsrv_connect()
, for the API for the microsoft driver, look at SQLSRV_Help.chm
which should be extracted to your ext
directory when you extracted the extension.
这篇关于PHP 致命错误:调用未定义函数 mssql_connect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHP 致命错误:调用未定义函数 mssql_connect()
基础教程推荐
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01