But I wanted to run code under Apache2 and when I set things up the way I've done many times on Linux, with a symlink from the Apache document root (/Library/Webserver/Documents) to my code, I was not able to view those pages due to permissions errors.
The issue is that your Documents directory has these permissions:
drwx------@ 17 jones jones 578 Dec 1 09:45 Documents
These mean that only the owner can access the files in that directory. Apache2 runs as user 'www' and even though you might have made the subdirectories world-readable, it is not able to follow the path get there.
You probably don't want to make your entire Documents tree world-readable, so you have two choices.
1: Make Documents executable by everyone, but not readable:
$ chmod a+x Documents
to get these permissions
drwx--x--x@ 17 jones jones 578 Dec 1 09:45 Documents
2: Move your code to your Public directory which by default is world readable and executable.
Debugging problems like this is a real pain. I assume I've screwed up the Apache httpd.conf file and so I'm looking through the countless directives in that. The Apache error logs don't tell you where the problem lies either, unfortunately.