简体   繁体   English

如何访问 Laravel 中的共享网络文件夹(scandir)?

[英]How can I access a shared network folder (scandir) in laravel?

I have three windows servers, one is a Domain Controller, one hosts laravel via IIS and the other is a windows server with a shared network folder for storage.我有三台 Windows 服务器,一台是域控制器,一台通过 IIS 托管 laravel,另一台是带有共享网络文件夹用于存储的 Windows 服务器。 Everytime I try to access the folder on the shared drive using the following:每次我尝试使用以下方法访问共享驱动器上的文件夹时:

scandir('\\\\servername\\foldername'); scandir('\\\\服务器名\\文件夹名');

I get the following error我收到以下错误

scandir(\\servername\\foldername,\\servername\\foldername): Access is denied. scandir(\\servername\\foldername,\\servername\\foldername):访问被拒绝。 (code: 5) (代码:5)

This is obviously a permissions error as the access to server is limited to only accounts in the DC's AD where as the laravel application is executing using the local IIS user.这显然是一个权限错误,因为对服务器的访问仅限于 DC 的 AD 中的帐户,而 Laravel 应用程序正在使用本地 IIS 用户执行。 Can someone please help me with what I should try to do?有人可以帮我解决我应该尝试做的事情吗?

Thanks!谢谢!

You should modify the IIS application pool identity to network service account and then modify the shared folder permission to let network service account to access.您应该将IIS应用程序池标识修改为网络服务帐户,然后修改共享文件夹权限以让网络服务帐户访问。

Details about how to modify application pool, you could refer to this article .关于如何修改应用程序池,可以参考这篇文章

More details about how to set the shared folder permission, you could refer to this answer .有关如何设置共享文件夹权限的更多详细信息,您可以参考这个答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM