I'm currently running Apache and PHP on a Fedora Core server i have dbase, odbc, and dba configured with php.

My question is the company I'm working for has a program that stores all their data into a Visual Fox Pro DBF file, but they would like this file to be read and updated by their web site as well. I have tried using dbase_open to read the file but when doing i receive an error that states "dbase_open() [function.dbase-open]: unable to open database fdadrugs.DBF"

I have also attempted to use dba_open no error when opening the file but when i try to get the keys it doesn't return anything.

Any help would be greatly appreciated.

Also here is the code both ways i am attempting

With DBASE

<?
$DBFfile = "fdadrugs.DBF";
$DBF = dbase_open($DBFfile,0) or die("Error! Could not open dbase database file '$DBFfile'.");
$Fields = dbase_get_header_info($DBF);
echo "<table cellspacing=0><tr><th>Name</th><th>Type</th>
<th>Length</th><th>Precision</th><th>Format</th><th>Offset</th></tr>";
foreach($Fields as $val)
{
    echo "<tr>
        <td>{$val['name']}</td>
        <td>{$val['type']}</td>
        <td>{$val['length']}</td>
        <td>{$val['precision']}</td>
        <td>{$val['format']}</td>
        <td>{$val['offset']}</td>
	    </tr>";
}
echo "</table><br><br>";
?>

With DBA

<?
$DBFfile = "fdadrugs.DBF";
$DBF = dba_open($DBFfile,"r") or die("Error! Could not open dbase database file '$DBFfile'.");
if ($key = dba_firstkey($DBF)) do {
    print("Key: $key    Value:");
    print dba_fetch($key, $DBF);
    print("<BR>");
} while ($key = dba_nextkey($DBF));
?>

    I would guess user permissions on the .dbf file.

      rsmith;10893289 wrote:

      I would guess user permissions on the .dbf file.

      thats what i originally thought too, so to test it i changed its perms to 777 so that wasn't the case.

        But what about user accounts that actually exist with the dbf file? You need to make sure you can open it with a user account that was setup inside the file.

          the database itself is world readable and writable, coming from the program its self with no password or username required to access it.

            Write a Reply...