2005/03/30

PHPmac - Additional Useful Apache2 Config Settings

I'd like to be able to replace Apache 1.3 on my iMac with Apache 2. I've installed the DarwinPorts port for apache2, but starting and stopping the server requires a trip to the command line. Is there any way to use System Preferences to control Apache 2?

Thanks to Google and the folks at phpmac for showing that the answer is "yes":

PHPmac - Additional Useful Apache2 Config Settings

2005/03/17

More Problems With Coal

Yesterday a study was publicized which claimed a correlation between mercury emissions from coal-fired powerplants and the incidence of autism.

On Tuesday the EPA issued a new "Clean Air Mercury" rule.

You would think this rule, which requires a 22% cut in mercury emissions by 2010, would gain some credit for the Bush administration, which has often been accused of weakening environmental regulations to the short-term benefit of industry. But it's not so simple. According to a Knight Ridder news article:

The Bush administration... [hailed] the reductions as the deepest cuts technologically possible... But nearly a dozen power plants nationwide have [cut] cutting mercury emissions by as much as 94 percent -- in test projects paid for by the same Bush administration.


Not long before the Three Mile Island incident, the Union of Concerned Scientists published a paper comparing total expected deaths from radiation, for
two types of powerplants: coal and nuclear. They concluded that nuclear power was safer. (!) If you consider other factors such as environmental damage caused by sulfur emissions (acid rain) and now mercury, the only advantages to burning coal are that: we have a lot of it; it's mined in areas which would otherwise be economically impoverished (e.g. West Virginia).

I think the paper was:
Union of Concerned Scientists. The Risks of Nuclear Power Reactors (Cambridge, MA: 1977).

2005/03/14

DarwinPorts and Subversion on Mac OS X

This is a recap of instructions posted by Bill Bumgarner (here and here) and James Duncan Davidson (here), on installing Subversion and Apache2 via DarwinPorts on Mac OS X 10.3.

Install DarwinPorts

Get DarwinPorts from CVS and build and install it. Assuming default installation locations are okay, this script should work:


#!/bin/sh

cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od login
cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od co -P darwinports
cd darwinports/base
./configure
make
sudo make install

Now you need to add the DarwinPorts binaries directory to your PATH. Depending on whether you prefer sh-like shells such as bash or csh-like shells, one of the following should work:

export PATH=$PATH:/opt/local/bin
set path=($path /opt/local/bin)

Install subversion and apache2

Next, using James's instructions as a guide, configure and install subversion and apache2. To do so, run the following script using sudo:

#!/bin/sh
port install apache2
port install subversion +mod_dav_svn +python
port install DarwinPortsStartup
Note a small problem here: This script installs subversion Python bindings, but only for a non-framework installation of Python. If you need bindings for a framework installation of Python, you're on your own.

Create The Repository

Bill created his subversion repository in /svn. I wanted mine in /usr/local/svn-repository, for no good reason.
$ sudo mkdir /usr/local/svn-repository
$ sudo svnadmin create --fs-type fsfs /usr/local/svn-repository/master
$ sudo chown -R www /usr/local/svn-repository
Patch httpd.conf

Bill has provided a patch for httpd.conf. It assumes that your subversion repository resides in /svn. If it resides elsewhere you'll need to change the patch file before applying it.

For example, since I put my subversion repository in /usr/local/svn-repository I had to change every reference to the /svn filesystem location in the patch file to point to /usr/local/svn-repository.)

You can copy the patch file to /opt/local/apache2/conf, and then apply it from there. Patch will ask you if it should assume this is a reverse patch (-R). Say 'y':

$ sudo cp my-httpd-conf-svn.patch /opt/local/apache2/conf/
$ cd /opt/local/apache2/conf/
$ sudo cp httpd-std.conf httpd.conf
$ sudo patch httpd.conf my-httpd-conf-svn.patch
patching file httpd.conf
Reversed (or previously applied) patch detected! Assume -R? [n]
y
Add Repository Users
$ cd /usr/local/svn-repository/
$ sudo -u www htpasswd -c master-auth mitch
New password:
Re-type new password:
Adding password for user mitch
Test The Apache2 Configuration
$ /opt/local/apache2/bin/apachectl configtest
Syntax OK

Start Apache2


It should start up, listening on port 8000.
$ sudo /opt/local/apache2/bin/apachectl restart
httpd not running, trying to start
At last you should be able to view the topmost directory of the (empty) subversion repository in your web browser, by loading http://localhost:8000/svn/