Moved directory read and write permissions check to index.php