I have two files stored in /var/www/

pi@babaloo /var/www/test $ ls -l
total 8
-rwxrwxrwx 1 pi pi 123 Nov  8 00:23 refresh.php
-rwxrwxrwx 1 pi pi 989 Nov  5 17:41 share.php

when i try to open refresh.php from my browser, I get a 500 response from refresh.php on share.php everything is ok.

dont know why, whats the reason and how to solve it ???

Whats the meaning of the "8" and "5" ?? may that cause the error?

EDIT: I just noticed, that all new files I create have the same problem. Old files are ok. I dont know what happend - any ideas what could be the reason and what can I do to fix this ?

  • 2
    8 and 5 are Nov8 and Nov5 =) – lenik Nov 8 '13 at 0:16

After uninstalling lighttpd and installing it again the problem has been solved.

But I still don't know why!?

| improve this answer | |
  • Did you log in as another user? maybe lighhtpd changed users for some reason. The permission look ok there but to whom do they belong? That is usually the problem relating to who created the files. ls -l filename – Piotr Kula Nov 8 '13 at 11:14
  • @ppumkin 3rd and 4th column show user and group. Both are pi for both files, so that isn't it. – Gerben Nov 8 '13 at 20:38

You also need to check the permissions of the directory /var/www/test to see if that is accessible for everyone:

ls -l /var/www

If test is owned by pi or root, the server won't be able to access the files inside it.

By default lighthttpd runs as user www-data, and can't access pi's files. You could use this command to change everything in /var/www to be owned by www-data:

sudo chown www-data:www-data -R /var/www

Then lighthttpd should be able to serve those files.

| improve this answer | |
  • 1
    This isn't advised. This would provide a way of attacking a server, as you might be able to upload a file to the server and run it. Just make sure the directory is both readable (r) and executable (x) by all users. sudo chmod o+xr /var/www should do that. – Gerben Nov 8 '13 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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