使用 php 的 ODBC/DSN 映射驱动器
我实际上正在尝试使用 PHP 的 ODBC 连接到 .mdb
数据库。
在我的本地主机上,它工作得很好,但是当转移到我的映射服务器时,它就不再工作了。 我知道,这是 UNC 和映射驱动器的问题。我已经尝试过了
\\Users\[...]\test.mdb
,
C:\[...]\test.mdb
第一个抛出 S1009 错误,第二个抛出 S1000 错误。我能做些什么?它是 Windows Server 2008 上的系统 DNS,正在运行 ODBC,未安装 Access。
I am actually trying to connect to a .mdb
Database with ODBC per PHP.
On my localhost it works great, but when transferred to my mapped server it isn't anymore.
I know, it is a problem of UNC and mapped drives. I already tried
\\Users\[...]\test.mdb
and
C:\[...]\test.mdb
First one throws S1009 as error, the second one S1000. What can I do? It is a System DNS on a Windows Server 2008, ODBC is running, no Access installed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您映射驱动器或使用 UNC 路径时,将在 Web 服务器的安全上下文中请求其中的文件。网络服务器用户几乎 100% 无法访问 LAN 中的文件共享。
保持这种方式,如果可能的话,amd 将 mdb 驻留在网络服务器本地的驱动器上。
When you map drives or use UNC Paths, the files there will be requested in the security context of the webserver. With close to 100% probability the webserver user has no access to the fileshares in your LAN.
Keep it that way amd have the mdb reside on a drive that is local to the webserver, if ever possible.
首先,确保您使用正确的 UNC 路径。例如:\\计算机名\Share\test.mdb。 StackOverflow 可能会吃掉您输入的任何双反斜杠,因此这可能是一个有争议的问题。
其次,确保为运行 PHP 脚本的帐户设置共享权限。根据我的经验,这是大多数“脚本无法访问共享”错误的原因。
First, make sure you're using a proper UNC path. For example: \\Computername\Share\test.mdb. StackOverflow might have eaten any double-backslashes you entered, so this may be a moot point.
Second, make sure the share's permissions are set up for whichever account runs the PHP script. This is the cause of most "scripts can't access a share" errors in my experience.