php fopen ftp_get 更改所有者/组 - 有时 - 为什么?
在我的 php 主机上,我有一个由 cron 作业运行的脚本,该作业从远程 ftp 服务器打开/覆盖文件。它在大多数情况下都有效,但我发现当它最初创建文件时,所有者/组是“736/736”,但在某些时候所有者和组更改为“99/99”。问题是我开始遇到权限问题 - 这是代码:
$local = fopen("/mypath/myfile.txt","w");
$result = ftp_fget($conn_id, $local,"remotepath/remotefile.txt", FTP_BINARY);
fclose($local);
我正在使用相同的代码来获取一堆文件。 并非所有文件都会发生这种情况。除了“读”类型的 fopen(“r”)之外,这个原始文件再也不会被触及。
我不认为这是 ftp_fget,因为我有一个不同的脚本,也由 cron 运行,通过 fopen“w”创建文本文件,其中一些文件也是所有者“99/99”。
有什么想法吗?这可能是 ISP 方面的配置问题吗?如果是这样,我该怎么告诉他们?当我告诉他们我的所有者/组是错误的时,他们完全重置了我的整个 ftp 目录 - 权限、所有者等,这很痛苦。
On my php host, I have a script that is run by a cron job that opens/overwrites a file from a remote ftp server. It works most of the time, but I am finding that when it initially creates the file, the owner/group are "736/736", but at some point the owner and group change to "99/99". Problem is I start running in to permissions issues - here is the code:
$local = fopen("/mypath/myfile.txt","w");
$result = ftp_fget($conn_id, $local,"remotepath/remotefile.txt", FTP_BINARY);
fclose($local);
I am using this same code to pull down a bunch of files.
It does not happen to all the files. This original file is never touched again, except for a 'read' type fopen ("r").
I do not think it is the ftp_fget, as I have a different script, also run by cron that creates text files via an fopen "w", and SOME of those files are also owner "99/99".
Any thoughts? Could this be a config problem on the isp's side? If so, what do I tell them? When I tell them my owner/group are wrong, they totally reset my entire ftp directory - permissions,owner, etc. which is a pain.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
组 UID 99 和所有者 UID 99 是
Nobody
或apache
。这对于文件系统创建的所有文件夹都是相同的。因此,当 cron 作业运行时,这些文件归apache
所有。解决方案:
The Group UID 99 and Owner UID 99 is
Nobody
orapache
. This is the same for all folders created by the file system. So, when cron job runs, the files are owned byapache
.Solutions: