First make sure that the owner of your file.php
script has write-access to the directory /var/www/
. is_writable()
will tell you.
Then: You are using a relative path, so the script tries to create a directory relative to its own location. You would need to
a) use an absolute path (/var/www/...
)
or
b) use a relative path but without the path file.php
itself is located in (e.g.: file.php
is = /var/www/file.php
, the use mkdir("devData/",0777);
).
Also: It of course says "created" because you print it out no matter what. If you want to have it say "created" only if nothing goes wrong, try
if (mkdir("devData/",0777)) {
echo "created";
}
else {
echo "something went wrong...";
}