intellix Posted November 29, 2010 Share Posted November 29, 2010 I've got a php script creating directories but it seems when I open them it says 'Failed to retrieve directory listing' within Filezilla as though the directory doesn't exist. I'm giving them the 0700 permission and in Filezilla if I give them 777 it still doesn't work. Am I doing something wrong or is this a limitation of somesort? // If directory does not exist, create it if (!is_dir($fullDirPath)){ mkdir($fullDirPath, 0700); } It's definitely there cauase I can see it and my code works with the files inside the directory but... just in FTP :/ Thanks! Link to comment https://forums.phpfreaks.com/topic/220171-mkdir-and-ftp-saying-failed-to-retrieve-directory-listing/ Share on other sites More sharing options...
BlueSkyIS Posted November 29, 2010 Share Posted November 29, 2010 don't know the answer, but I googled for info and found this: http://php.net/manual/en/function.mkdir.php You might notice that when you create a new directory using this code: mkdir($dir, 0777); The created folder actually has permissions of 0755, instead of the specified 0777. Why is this you ask? Because of umask(): http://www.php.net/umask The default value of umask, at least on my setup, is 18. Which is 22 octal, or 0022. This means that when you use mkdir() to CHMOD the created folder to 0777, PHP takes 0777 and substracts the current value of umask, in our case 0022, so the result is 0755 - which is not what you wanted, probably. The "fix" for this is simple, include this line: $old_umask = umask(0); Right before creating a folder with mkdir() to have the actual value you put be used as the CHMOD. If you would like to return umask to its original value when you're done, use this: umask($old_umask); Link to comment https://forums.phpfreaks.com/topic/220171-mkdir-and-ftp-saying-failed-to-retrieve-directory-listing/#findComment-1141090 Share on other sites More sharing options...
intellix Posted November 29, 2010 Author Share Posted November 29, 2010 thanks I found out that because I gave it 700 permissions, I wasan't able to delete the directories or set new permissions from FTP so I had to go into the server console, remove it, then PHP could create the directory again using the new 777 permission and now I can look at it like a normal folder Hate linux! googling commands and what not... you learn it then forget it when you come back to it at a later date Link to comment https://forums.phpfreaks.com/topic/220171-mkdir-and-ftp-saying-failed-to-retrieve-directory-listing/#findComment-1141091 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.