Before you start banging your head with this Mongrel,
please consider using Unicorn_Rails it is without a doubt the best server for rails out there
Zero downtime on restart for deployments, and its super efficient
—————————————
If you try to install mongrel on Mac OS X after installing Ruby 1.9.1, amd you getting an error like so:
i686-apple-darwin9-gcc -I. -I/gentoo/usr/include/ruby19-1.9.1/i686-darwin9 -I/gentoo/usr/include/ruby19-1.9.1/ruby/backward -I/gentoo/usr/include/ruby19-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O2 -pipe -march=nocona -fno-strict-aliasing -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common -o http11.o -c http11.c
http11.c: In function ‘http_field’:
http11.c:77: error: ‘struct RString’ has no member named ‘ptr’
http11.c:77: error: ‘struct RString’ has no member named ‘len’
http11.c:77: warning: left-hand operand of comma expression has no effect
http11.c: In function ‘header_done’:
http11.c:172: error: ‘struct RString’ has no member named ‘ptr’
http11.c:174: error: ‘struct RString’ has no member named ‘ptr’
http11.c:176: error: ‘struct RString’ has no member named ‘ptr’
http11.c:177: error: ‘struct RString’ has no member named ‘len’
http11.c: In function ‘HttpParser_execute’:
http11.c:298: error: ‘struct RString’ has no member named ‘ptr’
http11.c:299: error: ‘struct RString’ has no member named ‘len’
make: *** [http11.o] Error 1
Here’s What you need to do in order to fix it
here’s the updated instructions:
1) cd /usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/ext/http11
2) sudo vi / mate on http11.c and:
replace line 77 with
for(ch = RSTRING_PTR(f), end = ch + RSTRING_LEN(f); ch < end; ch++) {
replace line 172 with
colon = strchr(RSTRING_PTR(temp), ':');
replace line 174 with
rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon - RSTRING_PTR(temp)));
replce line 176,177
rb_str_substr(temp, colon - RSTRING_PTR(temp)+1,
RSTRING_LEN(temp)));
replace lines 298 299
dptr = RSTRING_PTR(data);
dlen = RSTRING_LEN(data);
3) save the file, close the vi / textmate
4) sudo ruby extconf.rb && sudo make && sudo make install
5) cd ../../lib/mongrel
(or the full path “/usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/lib/mongrel”
6) mate / sudo vi handlers.rb
7) fix the case statements in
On lines 208-212, change instances of “: false” to “then false”
8) sudo gem install gem_plugin (else mongrel may hang)
done!
notes:
1) your current rails app config may stop mongrel from running
but i know for sure if you do a new rails app and run mongrel its working
2) sorry windows guys, try to find where the mongrel gem files will be stored for later review when you do gem install mongrel and get the error msg
daicoden said,
September 24, 2009 at 12:16 pm
Every time I change http11.c it gets replaced with the original version when I run gem install mongrel.
Any idea how to tell gem not to replace the files?
I’m using Arch Linux.
rubynyc said,
September 25, 2009 at 1:29 am
Hello
You are not supposed to install the mongrel gem again
you are suppose to install it once, obviously it will fail, BUT pay attention it save the files for later review on your computer, so if you follow my guide you will be actually patching the broken installation to work, not installing the mogrel gem again.
p.s
ditch mongrel, its horible, heavy and does not use mutli servers on 1.9.1
strongly suggest you to use thin, light fast and works smoothly in 1.9.1
sudo gem install thin
if you need to see the log in the same style mongrel does, open up another terminal session and type
cd your project folder
tail -f logs/development.log
Hope this helps
Ami
daicoden said,
September 25, 2009 at 1:45 am
Hey Ami, Thanks!! I miss understood the last step. I’ll take your advice with thin.
jigfox said,
December 8, 2009 at 12:59 pm
This works on ubuntu, too.
Thanks that helped me out.
Matt said,
March 23, 2010 at 5:55 pm
Thanks for this. I’m now using thin and loving it.
Millisami said,
May 20, 2010 at 3:48 pm
I went with this solution of installing mongrel 1.1.6
http://github.com/gamache/mongrel-115-to-ruby-19
Tom said,
September 21, 2010 at 10:27 am
Hey, thanks man! That saved me a couple of hours 🙂