Unable to chmod files: “Operation not permitted”

自古美人都是妖i 提交于 2019-12-11 01:45:44

问题


i want to delete files from a directory via php. Somehow my php_errorlog always tells me:

[06-Jun-2010 19:38:46] PHP Warning: chmod() [function.chmod]: Operation not permitted in /Users/myname/htdocs/

if ($_POST) {
        echo "yeah!!!";
        print count($_POST['deletefiles']);
        chmod($path, 0777); //server rights
        foreach ($_POST['deletefiles'] as $value) {
            print $value;
            unlink($path .'/' . $value);
        }
        //chmod($path, 0666); //server rights
    }

what am I doing wrong? Thank you


回答1:


Does the user PHP is running as have write access to the files you're attempting to chmod? Remember that this user is most likely not the same as your own account.




回答2:


chmod these files to 0666 using your FTP client first.



来源:https://stackoverflow.com/questions/2985582/unable-to-chmod-files-operation-not-permitted

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!