开发者

File Permission

开发者 https://www.devze.com 2023-02-04 02:47 出处:网络
How i can set owner and group to file in php , i write chgrp(\"dompdf/background_image.html\",1122)开发者_高级运维;

How i can set owner and group to file in php , i write

chgrp("dompdf/background_image.html",1122)开发者_高级运维;

but this is not working

it Set 99 instead of 1122


PHP has a chown function available, however you need the permissions to do so, so you probably have to be root.

There is the change group functio also availbe, this is the one u used.

Examples are available there, you need the appropriate privileges. that is probably your problem.


Take a look at chown and chgrp.


From chgrp:

Only the superuser may change the group of a file arbitrarily; other users may change the group of a file to any group of which that user is a member.


Try shell_exec() http://php.net/manual/en/function.shell-exec.php

<?php
$output = shell_exec('chown ownername:groupname file.php');
?>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号