0

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/test.zip): failed to open stream: Permission denied in /var/www/html/*snipped*/upload.php on line 86, referer: http://foobar.com/*snipped*/upload.php?dir=/

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

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

1
  • 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, 2011 at 12:30

1 Answer 1

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .