Setting up apache on osx lion

This post was written 2 months ago.
Mon, 19 Dec 2011
For general website/ PHP development, I like to have multiple local sites running from my Sites folder using virtualhosts. Up until now i've usually done this with Xampp, but after hearing that the version of apache shipped with OSX 10.7 is fairly useable out of the box I thought i'd run with it.

First of all I uncommented a couple of lines from /etc/apache2/httpd.conf.

To enable PHP5:-

LoadModule php5_module libexec/apache2/libphp5.so

To enable the use of virtualhosts:-

Include /private/etc/apache2/extra/httpd-vhosts.conf

I can then create virtualhosts in /private/etc/apache2/extra/httpd-vhosts.conf like so:-

<VirtualHost *:80>
DocumentRoot "/Users/rickhurst/Sites/sandbox"
ServerName sandbox.macbook.local
</VirtualHost>

Then to serve a local site from http://sandbox.macbook.local add a line to /etc/hosts:-

127.0.0.1 sandbox.macbook.local

One issue that took me a while to figure out was that I was getting a 403 error when I tried to use AllowOverride All, which lets me use .htaccess

I found the answer here. Basically, the options line needs to be set to "Options All":-

<Directory "/Users/rickhurst/Sites/">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>

(The above rules are added to a file /private/etc/apache2/users/yourusername.conf). Remember to restart apache after making these changes!
Tags: apache / php / osx /
Comments

Running Google App Engine SDK on OSX lion

This post was written 2 months ago.
Thu, 01 Dec 2011
OSX Lion comes with python 2.7 as default. Although App Engine will run on 2.7, it is safer to develop on the version of python that your live app engine instances are running on, which in my case is python 2.5 currently.

From a fresh install of Lion, I did the following:-

Installed xcode via app store

Installed Google App Engine SDK for Python, by installing google app engine launcher (This contains the SDK and a launcher app).

Installed mac ports

In a terminal:-

sudo port -v selfupdate
sudo port install python25
sudo port install py25-pil

This means I can start my django server on python 2.5 using:-

python2.5 manage.py runserver

However if you want to run dev_appserver.py it will still try to use python 2.7 (which, unless you've installed it into your default python, will be without PIL)

you can use macports to set the default version of python:-

sudo port select python python25

Finally, you might want to set Python Path to /opt/local/bin/python2.5 in your Google App Engine Launcher preferences

refs:-

http://stackoverflow.com/questions/4868185/how-to-install-pil-on-mac-osx-10-5-8-for-google-app-engine

http://stackoverflow.com/questions/6152765/macports-didnt-place-python-select-in-opt-local-bin

Update: after upgrading google app engine SDK to version 1.6, I was getting an import error "No module named _ctypes". I have now upgraded to python2.6 and this fixed the issue.

Tags: python / appengine / django / osx /
Comments

Stop msn messenger spam in Adium

This post was written 2 years ago.
Thu, 03 Sep 2009
Annoyingly the default setting when you add an msn account to Adium is to "allow anyone to contact you". And boy they do! Even more annoyingly, the setting to switch this off is not on the Edit account -> privacy tab, but rather on the main menu: Adium-> Privacy Settings. You will need to be connected to your msn account for it to appear as an option in the pulldown menu.
Tags: osx /
Comments

windows stuck in insert mode - vmware/apple keyboard

This post was written 3 years ago.
Tue, 25 Nov 2008
I've done this before - running windows XP in vmware fusion on a mac(book), using the an apple super thin usb keyboard, somehow accidentally get myself into insert mode. Following the keyboard mapping advice on the apple site got me nowhere, but eventually found the solution as a post in the vmware forum:-

http://communities.vmware.com/thread/73504
"On my Apple USB keyboard, I found that the zero key on the keypad (that is, the wide 0 key to the left of the period key) toggles insert mode in Windows XP.

If pressing this key generates a zero instead, try toggling Num Lock. On my keyboard, the "clear" button (just above the 7 and just below the reduce-volume button) functions as Num Lock."

archived comments
Hey man, I feel your pain!! (But me on Parallels!) Thanks for sharing!

Btw - i recognize that view of Tobacco factory garden in ur twitter background! i worked there last year :)

benjee 2009-01-30 11:07:51
On the Apple Macbook Pro the key combo for getting out of insert mode while using Parallels is "fn + m". This would correspond to the zero key in num lock mode.

Sterling 2009-05-22 17:08:45
Tags: windows / osx / vmware /
Comments