문제

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