Making Merb 1.0 RC1 Play Nice With Passenger
MerbCamp wrapped up last weekend, and we were given Merb 1.0 RC1 . So I dove right in and upgraded a couple apps from 0.9.8, and everything was fine until I deployed the apps in production under Passenger . The first thing is merb now comes with a public/.htaccess file, and there are a couple lines we need to comment out in here so that Passenger doesn't use fcgi. Make sure the following lines are commented out in your public/.htaccess file
#AddHandler fastcgi-script .fcgi #AddHandler fcgid-script .fcgi #RewriteRule ^(.*)$ merb.fcgi [QSA,L]
There is no need for fcgi behind Passenger since Passenger uses rack. Now you should be able to deploy your app behind Passenger without many problems. There is still one problem you may come across. For some reason you can't have local variables set in a controller or your app will fail with the following error message
/usr/local/lib/rubyEE/lib/ruby/gems/1.8/gems/ParseTree-2.2.0/lib/parse_tree.rb:151: [BUG] Segmentation fault
So instead of this
def show
@post = Post.get(params[:id])
number = 100
number = number + 100
end
You would need to do this
def show
@post = Post.get(params[:id])
@number = 100
@number = @number + 100
end
I have not yet figured out why local variables cause the segmentation fault, but this is a quick way to get around it so that you app will still work.
You might be a web designer if...
1. If you overuse AJAX for household chores, you might be a Web developer.
2. If you think "passing the Acid test" doesn't refer to a drug problem, you might be a Web developer.
3. If your "Yo Mamma" jokes include the phrase, "padding: 200%", you might be a Web developer.
Do you have some of your own that aren't on the list? Lets hear them in the comments.