How to create a directory with php and chmod it to 0777? I have searched other stack articles related to chmod via PHP, all are file related, not directory...
public function store(Document $document) {
if (!isset($document->id)) { $document->id = $this->generateId(); }
//This is my guess how to do it..
$this->path = $this->path . DIRECTORY_SEPARATOR
if (!file_exists($this->path)) {
mkdir($this->path);
chmod($this->path, 0777);
}
//My guess does not work
$path = $this->getPathForDocument($document->id);
$data = $this->formatter->encode((array) $document);
return file_put_contents($path, $data);
}