I want to delete some files in a directory.So I used unlink() .But it doesn't delete the files in perticular directory.Is this a permission problem ?. If so how to solve that .

     $path_name="/etc/smokeping/devices/".$menu_name1;
        echo $path_name;

        // Delete file off of hard disk using PHP command unlink:
        $do = unlink($path_name);            
        if($do == "1")
            {
                echo "The file was deleted successfully.";
            }
        else
            {
                echo "There was an error trying to delete the file.";
            } 
有帮助吗?

解决方案

Your code most likely doesn't run as root and a file in /etc is most likely owned by root. So your PHP script cannot do anything to it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top