Diasparsoft Logo Let's write software that people understand.

Home | Contact

Training

JUnit support

Outsourcing

The work that Diasparsoft did for us was outstanding. We are now using the software on a daily basis and their work could well have a dramatic impact on the Reds' organization in the near future.Cincinnati Reds Baseball Club.


Publications

Tips & Tricks

Diasparsoft Toolkit

What is Diaspar?

Interesting Bits RSS

Home » Archives » September 2004 » File permissions and HTTPD

[Previous entry: "Revenge of popfile: Dude, where's my buckets?!"] [Next entry: "PHP: pass by value/pass by reference"]

09/27/2004: "File permissions and HTTPD"


Hey, folks. Here's a good tip.

Let's say you want to test your web site on your own box, and let's say you always want to use Eclipse while you're building your site. In this case, there's a good chance your Eclipse workspace is in your home directory. For me, that's /home/jbrains. Now in there you'll have a folder containing your project, within which you might have a folder called www containing the web pages. You now want Apache to serve up those pages.

Easy, right? Open httpd.conf, change the DocumentRoot to /home/jbrains/workspace/..., then restart Apache and you're done, right?

Not so, for me. I get Permission denied /. Why is Apache going to the root of my file system?!

Well, the short version is this: it isn't. Remember that Apache will operate under the user name apache by default, and so you must be careful with both file and directory permissions. In my case, /home/jbrains was owned by user jbrains and only accessible by the owner. Poor old user apache didn't stand a chance. Once I fixed that problem, I could see my web page!

So here's the tip: know what user an application is running with, and check directory permissions everywhere for that user.