I am trying to create a file and write a message in a folder called debug:
function debug($report){
$file="/debug/debug.txt";
file_put_contents($file,$report,FILE_APPEND | LOCK_EX);
}
The debug folder is in my root directory. But file fails to be created.. Why?
This code will open all the permissions for the folder.
Depending on what exactly you want to do with that folder, you might consider giving it slightly more limited permissions that allow only specific users to read/write to it.
Here are some other examples taken from the PHP manual – http://php.net/manual/en/function.chmod.php