问题描述
我有一个简单的脚本,将文件从一个SMB挂接复制到另一个。源文件系统是相同的,但Web服务器是不同的。我使用PHP处理文件通过将其复制到临时目录,然后执行额外的任务。这个设置在一个时间点工作,但似乎它不再正常工作。有人可以指向正确的方向吗?
fstab mounts :
// 192.168.0.x / share / media / folder smbfs username = user,password = mypass
//192.168.0.x/share2 / media / folder2 smbfs username = user ,password = mypass
PHP代码:
copy('/ media / folder / filename.txt','/ media / folder2 / temp / filename.txt');
错误:
警告:复制(/media/folder2/temp/filename.txt):无法打开流:在线xx
上拒绝/www/myphp.php中的权限
文件夹权限(不是装载,而是文件服务器上的源文件夹):
/ media / folder = 777
/ media / folder2 / temp = 777
解决方案我将命令更改为:
copy('/ media / folder / filename.txt','/ tmp / filename.txt');
显然,在SMB共享上处理文件比我想象的更困难。该文件应该在计算机重新启动时删除,或者可能是定期的,取决于系统设置。
I have a simple script which copies a file from one SMB mount to another. The source file system is the same, but the web server is different. I'm using PHP to process the file by copying it to a temp directory, then performing additional tasks on it. This setup was working at one point in time but it seems that it's no longer working correctly. Can someone point me in the right direction?
fstab mounts:
//192.168.0.x/share /media/folder smbfs username=user,password=mypass //192.168.0.x/share2 /media/folder2 smbfs username=user,password=mypass
php code:
copy('/media/folder/filename.txt','/media/folder2/temp/filename.txt');
Error:
Warning: copy(/media/folder2/temp/filename.txt): failed to open stream: Permission denied in /www/myphp.php on line xx
Folder permissions (not the mount, but the source folder on the fileserver):
/media/folder = 777 /media/folder2/temp = 777
解决方案I changed the command to:
copy('/media/folder/filename.txt','/tmp/filename.txt');
Apparently it's more difficult to process files on an SMB share than I thought. The file should be removed when the computer's rebooted, or possibly at regular intervals, depending on the system setup.
这篇关于如何通过SMB挂载复制PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!