i cant seem to make a folder using exec('mkdir new')
through php using the www-data account...I have done chmod 775 /var/www
however i still don't have privileges.
Although the foldering is being created, i get the following error
The new folder is actually being created....but the error is still popping up...
mkdir: cannot create directory `hello': File exists
I have set the owner of /var/www
to www-data
, yet the error still persists.开发者_Go百科
The problem is that there is a file or directory with such name already. See the error message:
mkdir: cannot create directory `hello': File exists
Try this:
cd /tmp
mkdir new_file
mkdir new_file
You will get the same error. It's not a permission problem. You cannot have two object with the same name in one directory.
May be not a permission problem?
mkdir -p new
You're creating the same directory multiple times. Each time you create it you must delete it before you create it again. Three solutions:
- Delete your file. E.g.
rm -rf hello
- If you don't want to delete it and create it again, just check to see if it already exists. If it does not then run mkdir.
- Ignore the problem and catch any errors. The directory will exist with whatever files it had before.
精彩评论