user478636
user478636

Reputation: 3424

'www-data' insufficient rights issue

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.

Upvotes: 0

Views: 453

Answers (3)

bchurchill
bchurchill

Reputation: 1420

You're creating the same directory multiple times. Each time you create it you must delete it before you create it again. Three solutions:

  1. Delete your file. E.g. rm -rf hello
  2. 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.
  3. Ignore the problem and catch any errors. The directory will exist with whatever files it had before.

Upvotes: 0

Michał Šrajer
Michał Šrajer

Reputation: 31182

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.

Upvotes: 1

Vi.
Vi.

Reputation: 38714

May be not a permission problem?

mkdir -p new

Upvotes: 0

Related Questions