PHP文件复制到另一台服务器;访问其他服务器上的文件系统 [英] PHP file copy to another server; Access filesystem on other server

查看:1059
本文介绍了PHP文件复制到另一台服务器;访问其他服务器上的文件系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



$ destination_directory ='我:\路径\ to \file \'。 $ theme_number;

if(!@ opendir($ desination_directory)){
echo'对不起,目的地目录找不到。
die();
}



我使用该进程检查目标文件夹的访问权限,并且一直收到错误返回结果。任何人都知道我在做什么错了?我几乎有其他的一切。我只是不知道如何访问这个服务器。



附录:我接受了下面的答案,因为它在技术上是正确的,我能够让Apache服务器被IIS服务器接受,但是,为了实现我的目标(让所有使用脚本的人都可以不受限制地将文件移动到服务器),这是不可行的。我将不得不在每台电脑上设置特定的功能。看起来最好的解决办法是在服务器上建立你想复制文件的脚本,然后用更传统的方式将它们从本地驱动器移动到该位置。这将意味着一个具有CGI-exec功能的文件服务器,但是,我们的服务器并不具备它。

你在窗户上,你有我:映射到一个共享,如\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\这些映射仅适用于当前用户(例如管理员帐户),而不是您的php可能运行的IUSR帐户(假设为IIS)。解决方案,不要使用映射,而是使用完整的unc路径名称,即\\ /文件夹/文件


I'm trying to write a PHP script to copy the files from your local machine to a server:

$destination_directory = 'I:\path\to\file\' . $theme_number;

if(!@opendir($desination_directory)) { echo 'Sorry, the destination directory could not be found.'; die(); }

I check the access to the destination folder with that process, and I keep getting the error return. Anyone know what I'm doing wrong? I pretty much have everything else in place. I just don't know how to access this other server.

Addendum: I accepted an answer below, because it is technically correct, and I was able to get the Apache server to be accepted by the IIS server, however, for what I was trying to accomplish (giving anyone who used the script unfettered ability to move files to the server), it was infeasible. I would've had to set up specific functionality on each of their computers. It seems the best workaround would be to establish the script on the server to which you would like to copy your files, and then move them from your local drive to that location in a more traditional means. That would mean a file server with CGI-exec capabilities, though, which our server did not possess.

解决方案

I'd guess that you are on windows and that you have I: mapped to a share such as \\server2\files ...

If so, that's your problem. These mappings are only avaialble to the current users (eg, the admin account), not to the IUSR account that your php is probably running as (assuming IIS). Solution, don't use mappings, instead use the full 'unc' path name, ie '\\server\share\folder\file.ext', also remember that the IUSR account will need access to these shares/folders/files

这篇关于PHP文件复制到另一台服务器;访问其他服务器上的文件系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆