No One Can Sabotage Me Like I Can

Lesson: After running emerge –update, pay close attention to the the changes in configuration files proposed by etc-update. I didn’t, and caused myself a lot of avoidable grief. During one of my system-wide updates, I trashed Apache’s config files. Being the slightly retarded geek wannabe that I am, I had a heck of a time tracking down the information I needed to get my LAMP server running the way I wanted it to.

After much Clustying, file editing, head-banging, hair-pulling and cussing, I found out that it was pretty much working in the first place. All it needed was a couple of minor tweaks.

I first noticed something was wrong when I fired up the test website I have lurking in my /home/lizardbrain/public_html directory. The pages all loaded, but instead of being interpreted, the PHP script was rendered as text. It didn’t take me long to find that I needed to add some stuff to /etc/conf.d/apache2 (file paths are the ones on my Gentoo box; your distro may stash the files in other places). The first thing I did was add “-D PHP5” to the APACHE2_OPTS line in /etc/conf.d/apache2. It still didn’t work — I kept getting “Not Found” error messages. Actually, I had fixed about half the problem and didn’t know it, so I continued to clusty and tweak the config files. Most of what I did was unnecessary, but at least didn’t break anything. What finally gave me the clue that I was on the wrong track was when I restored /etc/apache2/httpd.conf to its original condition and copied a .php file from my public_html directory to the server’s home directory: it worked. All I needed to do from that point was get Apache to serve pages to my test site.

For those of you who got here by querying the search term “apache2 Invalid command ‘UserDir’,” /etc/apache2/httpd.conf does not allow the setting of “UserDir public_html.” What I had to do was add another option, “-D USERDIR,” to /etc/conf.d/apache2. Then I had to edit /etc/apache2/httpd.conf to add UserDir instructions.

Here’s what it boiled down to:

In /etc/conf.d/apache2, add


to the APACHE2_OPTS line. Make sure you add these options within the existing quotation marks.

In /etc/apache2/httpd.conf, add

<IfModule mod_userdir.c>
UserDir public_html

This gave me basic functionality. Since there is no public access to this computer, I didn’t bother to add anything else to /etc/apache2/httpd.conf to restrict access. For those who need more security, I got this from the Gentoo Forums:

<IfModule mod_userdir.c>
UserDir public_html

# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.

# <Directory /home/*/public_html*gt;
# AllowOverride FileInfo AuthConfig Limit Indexes
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# Order allow,deny
# Allow from all
# </Limit>
# Order deny,allow
# Deny from all
# </LimitExcept>
# </Directory>

# Enable this additional section if you would like to make use of a
# suexec-enabled cgi-bin directory on a per-user basis.
#<Directory /home/*/public_html/cgi-bin>
# Options ExecCGI
# SetHandler cgi-script


Now, when I point my browser to http://mygentoobox/~lizardbrain/, my test site appears, and php scripts are rendered correctly. As usual, the Gentoo Forums were my best friend, once I figured out the correct search terms.


8 Responses to “No One Can Sabotage Me Like I Can”

  1. S. Weasel Says:

    So basically you’re running a server to nowhere? Or do you have something indescribably fascinating on the other side of a firewall…?

  2. lizardbrain Says:

    The stuff on the other side of my firewall is indescribably… something. I’m not sure “fascinating” is the correct term.

    Yes. It’s the [DUN! DUN! DUNNN!] Server To Nowhere. Actually, just a local LAMP server I can use while I try to teach myself PHP and MySQL.

    Here’s something they don’t tell you about learning stuff: aside from the fossilization of brain cells that occurs with age, failing vision hinders anything that requires the use of a computer screen. For the last two days I’ve been sweating over a code example that kept giving me an error message, and no matter how many times I proofread it, it looked good. Just a couple of hours ago I decided I couldn’t tell if one letter was a lower-case “i” like it was supposed to be, or a capital “I.” I replaced it anyway, and the darn thing worked. Looks like it’s shopping for stronger reading glasses for me tomorrow.

  3. Joan of Argghh! Says:

    I could sabotage you if I could understand you.


  4. lizardbrain Says:



  5. lizardbrain Says:

    That was supposed to be an ‘evil’ emoticon. Maybe it just looks weird with the font I’m using.

    I’ll probably drop by your place later; I’m busy geeking right now, and then I gotta go meet some friends. I’m not sure I can survive the whole ‘getting out of the house and interacting with people‘ thing.

  6. XOXO:-D Says:

    Duhhhh, WHAT?

    ps Stop wth the hair-pulling…..yer runnin’ out!


  7. tiebpasexesia Says:

    I read some of the posts and I think it is a great blog. Are you interested in my volatile can I have read a good joke in internet ;) What kind of lettuce was served on the Titanic? Iceberg.

  8. lizardbrain Says:


    I dunno if you’re a spammer or not, but I just happen to be building a joke database and I’m gonna steal that one.

Comments are closed.

%d bloggers like this: