Daily Archives: December 31, 2009

Migration problems with Apache from Leopard to Snow Leopard

I migrated my machine from Leopard to Snow Leopard, a few days ago. Then, I applied the Apple’s latest security patch. Unfortunately, it broke the Apache WebServer. I had to dig into the Console log to fix the error. Apparently, there is an issue with the ‘/usr/libexec/apache2/mod_include.so‘ file.

Therefore, I commented out the inclusion of mod_include from ‘/private/etc/apache2/httpd.conf’ file.

#LoadModule include_module libexec/apache2/mod_include.so

Also, I had to install the lynx (text-based browser for apachectl)

$ sudo port install lynx

And, several packages needs to be upgraded, for patching for 32-bit architecture to 64-bit architecture of Snow Leopard

$ sudo port upgrade –enforce-variants ncursesw ncurses openssl readline

sudo port upgrade ruby

$ sudo env ARCHFLAGS=”-arch x86_64″ gem install –no-rdoc –no-ri mysql —   –with-mysql-dir=/usr/local/mysql –with-mysql-lib=/

Note: the architecture of the CPU is now purely 64-bit. Thus, MYSQL gem needs to be compiled as x86_64

Also, mongrel and mongrel_cluster needs to be installed as well. They don’t get copied over from Leopard to Snow Leopard migration. In the /Library/Ruby/Gems/1.8/gems will be those packages. And, in the /usr/bin will be the gem scripts, e.g. mongrel_rails and mongrel_cluster_ctl

$ sudo gem install mongrel mongrel_cluster

Additionally, it is necessary to modify the .profile file, as MacPort puts /opt/local/bin before /usr/bin in the path. This causes problem.

The problem is with mongrel_rails loading the necessary ruby libraries. Thus, I modified .profile to:

export PATH=/usr/bin:/usr:sbin:/opt/local/bin:/opt/local/sbin:$PATH

This allows /usr/bin/mongrel_rails to take precedence over /opt/local/bin/mongrel_rails and fixes $LOAD_PATH problem with ruby loading incorrect libraries.

The correct libraries should be coming from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/ruby/gems/1.8/gems and not /opt/local/lib/ruby/gems/1.8/gems