“对未定义函数odbc_exec()的调用"连接到Linux PHP服务器上的Access数据库时出错 [英] "Call to undefined function odbc_exec()" error connecting to Access database on Linux PHP server
问题描述
我在尝试在Access数据库上运行测试查询时遇到以下错误 致命错误:在第536行上的/home/ratpackc/public_html/Preview/ADOdb/drivers/adodb-odbc.inc.php中调用未定义的函数odbc_exec()"
I am getting the folowing error trying to run a test query on an Access Database "Fatal error: Call to undefined function odbc_exec() in /home/ratpackc/public_html/Preview/ADOdb/drivers/adodb-odbc.inc.php on line 536"
我下载了(从 http://adodb.sourceforge.net 下载),并解压缩了adodb514的全部内容.zip放入我名为ADOdb的文件夹中. 我正在运行以下测试代码:
I downloaded (from http://adodb.sourceforge.net) and unzipped the entire contents of the adodb514.zip into a folder I named ADOdb. I am running the following test code:
<?PHP
include("ADOdb/adodb.inc.php");
$RecCount = 0;
$DBPath = realpath("TheData/TheData.mdb");
echo $DBPath . " <br />" . chr(13);
$DBConn =& ADONewConnection('access');
$DSN = "Driver={Microsoft Access Driver (*.mdb)};Dbq=$DBPath;";
$DBConn->Connect($DSN);
$SqlStr = "SELECT TheDate FROM SomeTable ";
echo $SqlStr . " <br />" . chr(13);
$DBConn->debug = true;
if ($DBConn->Execute($SqlStr) === false) print ErrorMsg();
$RS = $DBConn->Execute($SqlStr);
if (!$RS)
echo $DBConn->ErrorMsg();
else
while (!$RS->EOF)
{
$RecCount++;
echo $RS->fields("TheDate")." <br />" . chr(13);
$RS->MoveNext();
}
$RS->Close();
$DBConn->Close();
echo "<hr />" . chr(13);
echo $RecCount." <br />" . chr(13);
?>
您可以在 http://www.rat- pack.com/Preview/DBTest.php
如果这完全有帮助,请参阅我的phpinfo http://www.rat-pack .com/Preview/phpinfo.php
If it helps at all here is my phpinfo http://www.rat-pack.com/Preview/phpinfo.php
推荐答案
创建一个包含以下内容的示例文件:
Create a sample file that contains:
<?php phpinfo();
如果您没有看到odbc扩展名已加载,则需要将其加载到php.ini中或使用odbc支持重新编译.
If you don't see the odbc extension loaded you'll need to load it in your php.ini or recompile with odbc support.
这篇关于“对未定义函数odbc_exec()的调用"连接到Linux PHP服务器上的Access数据库时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!