Skip to content

Instantly share code, notes, and snippets.

@nexocentric
Created February 26, 2014 03:54
Show Gist options
  • Save nexocentric/9223248 to your computer and use it in GitHub Desktop.
Save nexocentric/9223248 to your computer and use it in GitHub Desktop.
functions for checking directory permissions
function checkFilePermissions($filename)
{
if(!file_exists($filename)) {
return "filename does not file_exists";
}
if(!is_file($filename)) {
return "filename does not is_file";
}
if(!is_readable($filename)) {
return "filename does not is_readable";
}
if(!is_writable($filename)) {
return "filename does not is_writable";
}
return;
}
function checkDirectoryPermissions($directory)
{
if(!file_exists($directory)) {
return "directory does not file_exists";
}
if(!is_dir($directory)) {
return "directory does not is_dir";
}
if(!is_readable($directory)) {
return "directory does not is_readable";
}
if(!is_writable($directory)) {
return "directory does not is_writable";
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment