0

I have a Internal PHP 7.3 Website that connects to MS Access (2003 / 365). The code is failing on the connection, although I have Microsoft's new 64Bit driver installed. The machine is 64 Bit and I'm using PHP 7.3.

I've listed my code and the setup below. Hopefully someone can give me direction on what I need to do. I've been searching the web for the last 7 days, and I haven't found anything that helps.

I "think" the problem is that PHP seems to be running in 32Bit ODBC mode, but nothing I've tried seems to change the value from 32Bit to 64Bit.

I checked this link which states that PHP and Office need to run at 32Bit, but I was wondering if things have changed in the last 7 years. PHP MS Access connection not working

I've put my entire setup in the attached image from the code to the odbc connection to the phpinfo and error message that I receive: "HTTP ERROR 500".

Here is the code:

<?PHP
   $bdconnection = 0;
   $bdconn=odbc_connect('WIKITEST','','');

   if (!$bdconn)
   {
       exit("Connection to the WIKITEST Database Failed: " . $bdconn);
   }
   else {
       $bdconnection = 1;
   }
?>

Here's the error from the logs:

[09-Mar-2022 13:25:40 America/New_York] PHP Warning: odbc_connect(): SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Access database engine cannot open or write to the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view and write its data., SQL state S1000 in SQLConnect in C:...\dbtest.php on line 3

Error on Page: Connection to the WIKITEST Database Failed:

PHP Database Err MS Access 2003 / 365 64Bit

Joseph
  • 1
  • 1
  • 2
    *"HTTP ERROR 500"* - That means an error occurred on the server. Make sure you enable error reporting in PHP, as well as check the PHP logs. You're going to need to find out what the error is before you can resolve it. – David Mar 09 '22 at 14:04
  • `I was wondering if things have changed in the last 7 years`...well Access 2003 sure hasn't changed in the last 7 years, so if it's still 32-bit then you'll still need to use a 32-bit process to connect to it, I would expect. – ADyson Mar 09 '22 at 14:18
  • Anyway yes, check your PHP error log (or turn on on-screen error reporting, if it's not a live environment) so you can see precisely what's going on. – ADyson Mar 09 '22 at 14:19
  • Also, you don't need to try random architectures. Driver needs to match PHP architecture. – Álvaro González Mar 09 '22 at 15:42
  • Please don't post code as screenshots, but copy it as text to your question (and format it properly). It is OK if you leave the other stuff as screenshots, but also please to as one big lump, it is hard to read and that will decrease your chances of getting useful answers. – cyberbrain Mar 09 '22 at 16:58
  • Thanks so much. Here is the code from the error logs: [09-Mar-2022 13:25:40 America/New_York] PHP Warning: odbc_connect(): SQL error: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Access database engine cannot open or write to the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view and write its data., SQL state S1000 in SQLConnect in C:\.. \dbtest.php on line 3 – Joseph Mar 09 '22 at 18:26

0 Answers0