Joho the Blogleopard Archives - Joho the Blog

January 14, 2009

Beginner-to-beginner: Restarting Apache after you’ve reinstalled Leopard from the Time Machine and your web server isn’t working

Last night I installed a new, blank hard drive on my MacBook. I installed from Time Machine, which went quite well. (I physically installed it, booted from a Leopard system disk, partitioned the disk via Tools > Disk Utility, restarted with the Time Machine external disk plugged in, went to Tools > Restore from Backup, chose the latest backup, and came back three hours later.) The process resulted in a painless transfer. Everything was working (as far as I can tell) except for the internal web server; my browser told me that it could not connect to http://127.0.0.1. I tried lots of things, including editing my httpd.conf file, following Webby advice (how could I go wrong?). Despite multiple restarts of apache, via Systems Pref and the terminal, no dice. (BTW, I’m running Leopard 10.5.6)

My friend Billo, diagnosed the problem almost immediately: I had no apache2 directory in /var/log/. So, I made one, changed the permissions, and a minute later, it was all up and running. (Thanks, Billo!)

In case you are feeling adventurous, here are the various commands to use in the terminal. (Note: I’m not good at this stuff. I’m likely to be giving you bad advice here. Most of it is pretty much non-destructive, though. I think.)

To restart the web server (=apache2): apachectl restart (Apachectl is in /usr/sbin/)

To create an apache2 directory in /var/log:

cd /var/log/
mkdir apache2
chown root apache2
chmod 755 apache2

It may take a minute or two for things to start working. If they do, when you go to http://127.0.0.1 in your browser, you should get a default page telling you that apache is working. And you’ll probably have to log in as root in the terminal to get permission to do this stuff.

Good luck. And, most important, don’t blame me!

[Tags: ]

2 Comments »

January 2, 2008

Beginnger-to-Beginner: Enabling php in Leopard

You want to see some nice tech writing? James Pelow at PHPmac explains how to enable the Leopard apache server to use php. It’s written so clearly, even I could follow the instructions! (Because he wrote this in 2005, you’ll want to change the references to php4 to php5.)

[Tags: ]

3 Comments »