Function to create recursive and writable folder, if we have permission, without generate a warnings :
/**
* Create correctly writable folder.
* Check if folder exist and writable.
* If not exist try to create it one writable.
*
* @return bool
* true folder has been created or exist and writable.
* False folder not exist and cannot be created.
*/
function createWritableFolder($folder)
{
if($folder != '.' && $folder != '/' ) {
createWritableFolder(dirname($folder));
}
if (file_exists($folder)) {
return is_writable($folder);
}
return is_writable($folder) && mkdir($folder, 0777, true);
}