Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I ran some recursive linux command that changed the permissions to all my website files..

all files are now like -rwxrwxrwx

and all dictionaries are. drwxrwxrwx

I don't know if that has anything to do with my problem really.. As I've changed that yesterday and it still worked.. But today I decided to update PHP from 5.1.6 to 5.3 and I've restarted apache..

I'm guessing it could be 2 things.. one the new PHP is screwed up somehow. Other is the permissions I set yesterday took effect today when I restarted apache..

The errors by the way are like.

PHP Warning: move_uploaded_file(/var/www/html/ failed to open stream: Permission denied in /var/www/html/*snipped*/upload.php on line 86, referer:*snipped*/upload.php?dir=/

PHP Warning: move_uploaded_file(): Unable to move '/tmp/php7qcj4A' to '/var/www/html/' in /var/www/html/*snipped*/upload.php on line 86, referer:*snipped*/upload.php?dir=/

As well as other commands like mkdir() all failing now.

share|improve this question
This seems to be a permission related issue. We will need to know the permissions and owner of the files. Do ls -las on the directories /var/www/html/ and /var/www/html/*snipped* and post the output here ;) – Robert Dec 28 '11 at 12:30

If /var/www/html/ holds all your web-files, you have to take care that your webserver user has appropriate rights to access the directory. You can fix this by changing the owner of the directory recursively to whatever your webserver user is

chown -R www-data.www-data /var/www/html/

(check your apache configuration for the user directive and take the value from there. It doesn't necessarily have to be www-data).

Next step is to remove the '777-junk' again. It is never ever a good idea to open a directory worldwide, and it is almost never needed either. Not even for temp, cache or other folders like this. Just ensure that the webserver can read-write-execute it.

share|improve this answer

Your Answer


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.