PHP upload error: Permission Denied

Get help on web editors (Frontpage, Dreamweaver) and web languages (HTML, ASP, PHP).
Post Reply
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

PHP upload error: Permission Denied

Post 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.
Image
DarkRanger
Registered User
Posts: 8346
Joined: 10 May 2006, 02:00
Processor: Intel i5-3750
Motherboard: Gigabyte
Graphics card: nVidia GTX 550Ti
Memory: 8GB Jetram
Contact:

Re: PHP upload error: Permission Denied

Post 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:
Image
ameaq
G3AR Webmaster
Posts: 4
Joined: 10 Aug 2011, 07:38

Re: PHP upload error: Permission Denied

Post 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
Post Reply