B
B
bah20162016-07-11 17:03:51
PHP
bah2016, 2016-07-11 17:03:51

Windows server 2008 r2 + iis 7 + php 5.4.6 + base on ms access?

When run from an account with administrator rights, the php script works. When run as a normal user, respectively, no. Please tell me what rights should be given to a user with limited rights to connect, read and write from / to the ms access database?

<?php
$path = "1.accdb";
$conn = new COM ('ADODB.Connection') or die('Cannot start ADO');
$connStr = "PROVIDER=Microsoft.Ace.OLEDB.12.0;Data Source=".$path;

try {

                $conn->open($connStr);

}

catch (Exception $e) {

                echo "Error: ".$e->getMessage()."<br />";

}
$query = "SELECT * FROM tblvisits";
$rs = $conn->execute($query);
$num_columns = $rs->Fields->Count();
for ($i=0; $i < $num_columns; $i++) {

     $fld[$i] = $rs->Fields($i);

}
echo "<table>";
while (!$rs->EOF)

{

     echo "<tr>";

     for ($i=0; $i < $num_columns; $i++) {

        echo "<td>" . $fld[$i]->value . "</td>";

     }

     echo "</tr>";
$rs->MoveNext();
 }
echo "</table>";
$rs->Close();

$conn->Close();
$rs = null;
$conn = null;
?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kuznetsov, 2016-11-25
@DarkRaven

There is a possibility that your limited user does not have access to the folder where the database file is located. He must be able to read and write in this folder

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question