Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running Ubuntu 8.04 LTS, its my webserver (LAMP).

My web root is:

/var/www/website/trunk/html/

I created a directory for user uploads behind that, at:

/var/www/vault/

I did:

chown -R www-data /var/www/vault/

and even, bravely: (was a desperate moment)

chmod 777 -R /var/www/vault

My php script is unable to create subdirectories under:

/var/www/vault

and I need it to, I have had luck uploading a file to the directory however, I get errors like this when it tries to make directories...

Warning: mkdir() [function.mkdir]: Permission denied in /var/www/website/trunk/html/jquery.uploadify/uploadretro.php on line 149
File /var/www/website/trunk/html../../../../vault/4d4d3092c24be8a8dac2ec269e969446.jpg does not exist.

Could anyone help me out, or suggest something?

My php INI file is setup correctly allowing uploads, with a 5m size.

Any ideas?

More Info The command at line 149 from the error above is:

mkdir(str_replace('//','/',$targetPath), 777, true);

Permissions:

drwxrwxrwx  2 www-data root 4.0K Jun  3 06:04 vault
share|improve this question
    
0.04??? Not that it should matter, but that isn't a real version. –  Zoredache Jun 3 '09 at 4:13
    
echo out $targetPath, is it really what you think it is? –  derobert Jun 3 '09 at 4:40
    
haha ty, changed to 8.04 –  Mike Curry Jun 3 '09 at 13:38

2 Answers 2

up vote 3 down vote accepted

To help debug access I suggest you tothe system, and run a command like sudo -i -u www-data. This will give you a shell with the same privileges as the web server. Then simply change into /var/www/vault directory and see if you can create files and directories.

If you can create files/directories, then you problem is not permissions, and instead something is broken in your application.

Oh, and btw your path looks broken.

/var/www/website/trunk/html../../../../vault/

Pay particular attention to the html... If html.. is the correct value, then that path is going to resolve to /var/vault, not /var/www/vault.

share|improve this answer
    
the sudo -i -u www-data did the trick... I missed the second group setting, should have been chown -R www-data:www-data /var/www/vault/ instead of chown -R www-data /var/www/vault/ –  Mike Curry Jun 3 '09 at 4:43

Restart apache.

share|improve this answer
    
Warning: mkdir() [function.mkdir]: Permission denied in /var/www/website/trunk/html/jquery.uploadify/uploadretro.php on line 149 File /var/www/website/trunk/html../../../../vault/4d4d3092c24be8a8dac2ec269e969446.jp‌​g does not exist. –  Mike Curry Jun 3 '09 at 4:05
    
html.. <-- is that intentional? –  Alex Jurkiewicz Jun 3 '09 at 4:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.