It seems that with Leopard Apple has decided to go forward with Apache2 henceforth. This is great but if you’re like me and do all your development on your local machine using Apache & PHP and all that jazz there’s a good chance that installing Leopard hosed your local webserver and PHP install to some degree.
The errors I was getting were:
[error] [client 10.0.1.198] client denied by server configuration: /Users/chris/Sites/index.html
AKA: the dreaded 403.
Solution: In the Terminal do the following:
sudo cp /etc/httpd/users/chris.conf /etc/apache2/users/
Replacing the name of your user for “chris”. Restart Apache2:
sudo apachectl restart
You should at least now be able to see your files, even if the PHP ones are showing up as text.
To get PHP working again, once more in the Terminal:
sudo nano /etc/apache2/httpd.conf
Find the line
#LoadModule php5_module libexec/apache2/libphp5.so
and uncomment it (ie: delete the # from the front). Save that file. Restart Apache2 per above.
Basic PHP should now be working, but in my case phpMyAdmin wasn’t because once again the location of mysql.sock has changed.
To get that working again, follow the instructions I posted over a year ago in “phpMyAdmin, ‘Error #2002 – The server is not responding’, and OS X 10.4.4″.
chris on October 29th 2007 in /dev/random
Pundit Giles Bowkett opined that “Debugger support is for languages that you can’t run tests against gracefully” and wow, has it ever set the bogosphere all aTwitter*.
I beseech everyone: please stop beating that horse. It’s dead. Pining for the fjords, fit for leather and glue dead.
Use a debugger, don’t use a debugger. Use put statements, don’t use assertions. Use voodoo, don’t use prayer. Who cares? Write code.
Since he started it it seems best best to let Giles finish it:
I blogged about Gyre, a Rails debugger built in Rails, several months ago. I blogged today a ghetto Rails debugger built out of RCov, Mongrel, and tests. People are over-reacting to this anti-debugger post in a big way.
I’m so tired of it.
(*no part of that sentence is a typo.)
chris on October 19th 2007 in /dev/random
Ciarán Walsh has created ToolTips, a TextMate plugin that provides a tooltip for items in a TextMate project drawer that have had their name truncated. This happens to me fairly often since I tend towards very verbose, descriptive names for my Rails models and controllers.
Two things: first, it’s not quite perfect. It works on some files and not others. I’m sure there’s a good reason/bug behind that one.
Second: this should be core functionality in TextMate and hopefully it’ll be included by default at some later date.
chris on October 19th 2007 in Uncategorized
Converting a hash into an array in Ruby is easy but what about an array into a hash? This code does the trick quite nicely, and if you don't want to actually extend the Array class this does as well:
RUBY:
-
a = ["cat","dog","monkey"]
-
h = Hash[*a.collect { |v| [a.index(v), v] }.flatten]
Update: Speaking of mucking about with arrays, ArraySugar adds a few nice shortcuts to arrays. I like the select syntax (but it seems like overkill to install this as a gem).
chris on October 7th 2007 in /dev/ruby