Avatar of bgraves
bgravesFlag for United States of America

asked on 

New IIS, Win Server 2019 install. ODBC via php driver not see network files

I have a small PHP 7.4 program running off IIS 10 on Win Server 2019. Fresh Server 2019 install.

The program makes an odbc connect to a local .accdb file no problem.
It fails to connect to any network copy of that file:
   Mapped a drive letter -or-
   unc \\192.168....\folder\file.accdb   -or-
   \\Server_name\folder\file.accdb

Running the same code from VS 2019 on a non-server PC (uses IIS Express) works fine to all of the above test files. The reported error is:

SQLSTATE[HY000] SQLDriverConnect: -1032 [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.
I have triple checked folder and file permissions; the file is not opened; AND no problem from the VS 2019 with IIS Express on another PC to the same file.

I think it is something about the IIS install but I have no more ideas on where to look!

Windows Server 2019PHPNetworking

Avatar of undefined
Last Comment
Scott Fell
Avatar of bgraves
bgraves
Flag of United States of America image

ASKER

Just some more info.
On the server, I have a program that uses oledb and it can read all the same test files on all the different paths shown above. Since oledb can read the files from the server, and since a different PC can read the files using odbc, I think the problem is somehow related to IIS and the network. It does not seem to be the file shares. Also, recall that IIS can work fine using odbc on a local copy of the file!
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

It has been a very long time since I have used access on a website, but you do need to give the folder access is in both read and write permissions for the web user.
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Some quick research shows you may also have to give the same privileges to the temp folder https://docs.microsoft.com/en-us/troubleshoot/aspnet/permissions-connect-a-remote-access-database

SQL Express would be a better option if you can port the data over. There would be a few minor items to fix such as wildcards in queries. At least that was the case many years ago.
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo