Editing the WebServer/Documents directory

J.M.J.

Registered
PHP is working. Apache is up and running.
But Apache automatically locks the Documents directory while the webserver is on. This means I have to turn it off (and reboot too for the change to take effect?) before I can save a file in the Documents directory. And then I have to turn the webserver on again so I can look at the new html/PHP-documents from within a webbrowser.
<BR>
There have to an easier way?!
Can't I unlock the Documents directory once, and then it is unlocked at least until next reboot of the webserver (if not until I choose to lock it again)?

TIA

/J.M.J.
 

Fahrvergnuugen

I am the law!
Something is wrong there. Apache does not "lock" the documents directory. The only time you should ever have to restart apache is if you change the httpd.conf file. Even then you don't have to reboot [apachectl restart or just stop/start from file sharing control panel].

You can't write files to the directory I'm assuming? Is it a permission problem?
 

J.M.J.

Registered
You can't write files to the directory I'm assuming? Is it a permission problem?
I guess that's possible. When I try to save a document in the documents folder from within TextEdit, TE just says "Couldn't save document as /Library/WebServer/Documents/test.html".
And when I view the folder called "Documents" in the Finder...sorry, in the Desktop, there is this pen with a diagonal line across it. I assume that is the locked-symbol.

I am running MacOS X PB and I am logged in as an admin (I am the only user of the computer). If it matters, I get a "403 Forbidden" error in the webbrowser when I try to access anything in the cgi-directory (for example, trying to access "http://localhost/cgi-bin/printenv" results in a 403 error). However, accessing "http://localhost/test.php" results in a correctly formatted PHP-page rather than a 403 error.

Do I have to be logged in as "root" to be able to change WebServer/Documents??

/J.M.J.
 

Jurneyman

Uber Geek.
Check the permissions/ownership of the directory and or files.

ls -l /Library/WebServer/
or
ls -l /Library/WebServer/Documents/

This will show the owners and permissions of everything listed in the directory

To change the permissions of a directory / file, do

man chmod <-- this will tell you how.

ie: chmod 777 /Library/WebServer/Documents will allow anyone and anything full rights to what ever is in that dir. But you can asign differnet rights/permissions/owners to files in that folder, leaveing others unchanged.


 

J.M.J.

Registered
I did "ls -l" on the WebServer directory.
I learned that there is a difference between <br><br>[localhost:/] username%<br> and <br>[localhost:~] username%<br>:)<br>Anyways, there was a few "w" missing, so I tested with <br><br>chmod a+w Documents<br><br>and first it didn't work at all because it said I did not have the permission. So I wrote <br><br>su<br><br>(which I've seen a few times before on this forum. SuperUser, ehh?) and then the prompt said "root#" and then chmod worked fine! The crossed pen in the Desktop-window disappeared. So now everyone has access to that directory. That is ok until I get a bit better on this with UNIX and file permissions (I am also the only one using this computer anyway)<br>What I think is a bit confusing is this with "owner", "group" and "world" permissions. <br>I mean, what kind of users does the group include?<br>And what's the real world difference between root and admin?<br><br>
There's a lot of new stuff for a mac-only-user in OS 10 I might say :D
Thanks for the help!
PHP is pretty cool...<br>
J.M.J. - who today made progress in the strange world of UNIX
 

Fahrvergnuugen

I am the law!
Root aka SuperUser is just that. There is nothing that root cannot do. root can delete the whole system folder if it wants. Doing things as root is dangerous [probably the reason why the root account comes disabled out of the box] and should be used sparingly. Admin users can do a lot of things, like install software, but they are limited for the protection of the system.

I hope I explained the reasons / differences between root and admins well enough :)
 
Top