Page 1 of 1

PHP upload error: Permission Denied

Posted: 19 Aug 2010, 09:25
by DarkRanger
I've coded a php page to upload. Upon testing, it worked fine, I could use it to upload document to both localhost (not an achievement of note) and a locally hosted webserver.

Now we've recently been getting a problem:

Code: Select all

Warning: move_uploaded_file(../qms/procedures/1_quality/VCE-SOPQMS-01-07 - Control of Non-conformity.pdf) [function.move-uploaded-file]: failed to open stream: Permission denied in /var/www/qms/upload_file.php on line 19

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpWRVGGA' to '../qms/procedures/1_quality/VCE-SOPQMS-01-07 - Control of Non-conformity.pdf' in /var/www/qms/upload_file.php on line 19

Warning: Cannot modify header information - headers already sent by (output started at /var/www/qms/upload_file.php:19) in /var/www/qms/upload_file.php on line 31
So I went googling. My first thoughts were folder permissions, and google confirmed this. So I did the following commands and tried again:

Code: Select all

chown www-data /var/www/
chgrp www-data /var/www/
chmod 777 /var/www/
Yet, I still get that error. Does anyone know what I am missing.

Re: PHP upload error: Permission Denied

Posted: 19 Aug 2010, 09:33
by DarkRanger
Turns out the sub-directories didn't have their permissions changed... I should have run:

Code: Select all

chmod -Rf 777 /var/www/
Problem self diagnosis FTW! :lol:

Re: PHP upload error: Permission Denied

Posted: 10 Mar 2012, 23:31
by ameaq
What is the nature of your server, Apache?
Sounds like your max file upload size is set below your 'maximum user file upload size' .
This can be adjusted