建立与从PHP写入文件(具有755权限)失败,因为PHP以"nobody"身份运行并且目标文件所有者是另一个用户 [英] Creating & writing to a file (with permission 755) from PHP fails as PHP runs as 'nobody' and target file owner is another user

查看:371
本文介绍了建立与从PHP写入文件(具有755权限)失败,因为PHP以"nobody"身份运行并且目标文件所有者是另一个用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个PHP代码,该代码使用fopen创建另一个PHP文件并将其写入.它可以在大多数共享环境中运行,没有任何问题,但是在某些旧服务器和自定义服务器中,即使文件夹权限为755,代码也无法创建文件并写入文件,因为PHP在"nobody"帐户下运行,而文件夹所有者是另一个用户.

I am writing a PHP code that creates another PHP file with fopen and writes to it. It runs on most shared environments without any problem but in some old servers and customized servers the code fails to create file and write to it even though the folder permission is 755 as the PHP runs under the account 'nobody' and the folder owner is another user.

在共享服务器中,文件夹所有者和PHP都在同一用户下运行,因此没有权限问题.

In shared servers the folder owner and the PHP both runs under same user and so there are no permission issues.

有人可以在这里为我提供解决方案吗.....

Can anyone help me out here with a solution please.....

谢谢大家...

此问题可能已经困扰了许多其他问题,包括Joomla,Drupa等软件包.它们如何解决此问题?谁能解释一下.谢谢.

This problem might have bugged many others including packages like Joomla, Drupa, etc. How do they get around this problem? Can anyone explain please. Thank you.

推荐答案

没有直接解决此问题的方法.因此,唯一的解决方案是向用户显示一条相关消息,并要求他们手动复制文件...

There is no direct solution to this problem. So the only solution was to show the user a relevant message and ask them to copy the files manually...

这篇关于建立与从PHP写入文件(具有755权限)失败,因为PHP以"nobody"身份运行并且目标文件所有者是另一个用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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