You are not logged in.
Hi,
I'm new to PHP, so the question may be dumb. On the other hand, I haven't been able to find much with Google. How am I supposed to debug/modify files in /srv/http as a user? Even on localhost? I've been thinking there should be a suitable group, but this doesn't seem to be the case.
Last edited by Llama (2012-03-28 19:30:27)
Offline
I use the http group, IIRC that's the normal way to do it. Basically, use whatever group the web server runs as.
Last edited by Barrucadu (2012-03-26 17:10:20)
Offline
Something is incorrect. Apache, presumably, runs as http, as I've configured it according to Wiki: https://wiki.archlinux.org/index.php/LAMP#Apache (how am I supposed to check it, BTW?).
My group list:
$ groups
sys tty wheel log http network video audio optical floppy storage users wireshark
I can't write:
$ pwd
/srv/http
$ touch writetest.php
touch: cannot touch `writetest.php': Permission denied
Offline
You need to be in the http group, and the directory needs to be group-writeable.
Offline
I usually set up userdir and then do my development in my home folder.
Offline
I know it's off topic but:
Please don't learn PHP, it's a horrible language
☃ Snowman ☃
Offline
Llama, I prefer using ACL's in such cases. Just mount the partition containing /srv/http with "acl" option and you'll be able to use setfacl/getfacl to edit/view ACL entries. In your case two additional entries would be required:
# setfacl -m user:your_username:rwx /srv/http/
# setfacl -m default:user:your_username:rwx /srv/http/
I'm not sure whether it's the "right way" but it works.
robmaloy, your argument is very convincing. I'd like to hear your opinion about other languages.
Offline
Thank you, Atragor! I'll try your solution. BTW, nobody seems to know what the "right way" is. Google fetches the question, but nothing worth the name of the definitive answer.
robmaloy: I don't care about PHP, too. Sometimes one just can't give it the slip.
Offline
A little something is still out of whack with ACL, Atragor:
[alexey@stovepipebox bimbo]$ getfacl /srv/http/
getfacl: Removing leading '/' from absolute path names
# file: srv/http/
# owner: root
# group: root
user::rwx
user:alexey:rwx
group::r-x
mask::rwx
other::r-x
default:user::rwx
default:user:alexey:rwx
default:group::r-x
default:mask::rwx
default:other::r-x[alexey@stovepipebox bimbo]$ pwd
/srv/http/bimbo
[alexey@stovepipebox bimbo]$ ls -l
total 16
-rw-r--r-- 1 root root 886 Mar 12 17:44 mysql_up.php
-rw-r--r-- 1 501 80 175 Mar 28 07:29 test.php
-rw-r--r-- 1 501 80 171 Mar 28 07:22 test.php~
-rw-r--r-- 1 root root 851 Mar 25 18:31 testtype.php
-rw-r--r-- 1 root root 0 Mar 28 07:46 writetest.php
[alexey@stovepipebox bimbo]$ touch ww.php
touch: cannot touch `ww.php': Permission denied
[alexey@stovepipebox bimbo]$ groups
sys tty wheel log network video audio optical floppy storage users wireshark
[alexey@stovepipebox bimbo]$ cd ..
[alexey@stovepipebox http]$ ls -l
total 4
drwxrwxr-x 2 root root 4096 Mar 28 07:46 bimbo
[alexey@stovepipebox http]$
No '+' signs anywhere. I removed myself (alexey) from http group as it's not needed any more (?).
Last edited by Llama (2012-03-28 12:34:04)
Offline
I erroneously supposed that /srv/http was empty. Use setfacl with -R option to change ACL's of all nested folders and files (details are in the man page).
Offline
Thank you very much, Atragor!
Offline