I know there is a lot of answers for this already but it just doesn’t work.
I am trying to make my php script to create a folder on my ubuntu apache server.
if (!@mkdir($url, 0700, true)) {
$error = error_get_last();
echo $error['message'];
}
Now I have changed the permission for www-data
to 777
and www-data
owns the folder var/www/html
and all of the subdirectories.
Now what to do?
The $url
I pass is /files/test3
I have tested with /files/test3/
as well but that doesn’t work.
Edit:
2
Answers
You are trying to make a folder with an absolute path (/files/test3) which literally makes /files/test3 [which you probably do not own /files, and cannot make folders off / because you’re not root], not /var/www/html/files/test3.
You can use
__DIR__ . '/' . $url
or set $url tofiles/test3
instead.Try this:
Should create a folder
files
, with another foldertest3
inside of it, in the home directory.