文件所有者/组48/48 [英] File owner/group 48/48

查看:152
本文介绍了文件所有者/组48/48的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题。在我的PHP主机创建文件或目录时(通过 rename() mkdir())我的文件是创建与OWNER 48,组48,而不是FTP OWNER / GROUP(像其他主机)。



问题是,如果我做一个 mkdir ()例如,通过PHP,我不能管理这个目录(像把一些文件,重命名目录或删除),即使在PHP中!如果我通过FTP创建这个目录,我可以做所有的事情。真奇怪。

现在我需要知道:我错了,或者我的PHP主机被窃听了?他们告诉我这是一个代码问题。

我的代码:

pre $ code > mkdir($ image_dir,0777,true);

它会在FTP上创建类似的内容:

 名称类型日期持有量/组
。1967 [DIR] [DATE] fle(0755)48/48

即使我将 mkdir()上的chmod设置为0777,它也会创建为0755。所以,我可以做点什么,或者我的主人需要吗?

谢谢!

解决方案

起初,这并不奇怪,webserver / php作为不同于ftp客户端的用户运行是很好的。

那么这是丑陋的,但可以帮助你:在php中使用 umask(0000); 在任何文件操作之前。它会尝试创建所有文件和目录 0777 创建php时。



你应该检查如果web服务器/ php和FTP客户端至少在同一组,所以你可以使用umask 0007。



btw。 PHP运行在安全模式?它可以防止使文件可以写入其他用户...无论如何,你应该确保禁用它,因为它已被弃用,因为PHP 5.3自5.4以来删除


I'm having a problem. In my PHP host when I create a file or dir (via rename() or mkdir()) my files are created with OWNER 48, GROUP 48, instead of FTP OWNER/GROUP (like other hosts).

The problem is that if I do a mkdir() for instance, via PHP, I can't manager this dir (like put some files in, rename dir or remove), even in PHP! If I create this dir via FTP I can do all. Really strange.

Now I need know: I'm wrong or my PHP Host is bugged? They told me that it's a code problem.

My code:

mkdir($image_dir, 0777, true);

It'll create on FTP something like that:

NAME   TYPE  DATE   PERMS      OWNER/GROUP
./1967 [DIR] [DATE] fle (0755) 48/48

Even I set chmod on mkdir() to 0777, it create like 0755.

So, I can do something, or my host need does?

Thanks!

解决方案

at first this is not strange, it's good that webserver/php are running as a different user than your ftp client.

well this is ugly but may help you: in php use umask(0000); before any file operations. it will try to make all files and directories 0777 when created by php.

you should check if webserver/php and ftp client are at least in the same group so you can use the umask 0007.

btw. does php run in safe mode? it could prevent making files writable to other users... anyway you should be sure to disable it as it's deprecated since php 5.3 and removed since 5.4

这篇关于文件所有者/组48/48的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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