LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 12-13-2010, 10:24 AM   #1
arond
LQ Newbie
 
Registered: Dec 2009
Distribution: OpenSuse 11.3
Posts: 5

Rep: Reputation: 0
Question "/etc/init.d/apache2" start VS "apache2ctl start" with passenger module (ruby/rails)


Version: opensuse 11.3
Apache/2.2.17

I have a Sinatra application running on top of passenger module for Apache. Ruby 1.9.2

The application works if apache is started with "apache2ctl start", however, it doesn't when calling "service apache2 start".

The error comes from passenger:
Quote:
Error message:
invalid byte sequence in US-ASCII
Exception class:
ArgumentError

Backtrace:
# File Line Location
0 /usr/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb 897 in `gsub'
1 /usr/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb 897 in `inline_templates='
2 /usr/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb 850 in `set'
3 /usr/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb 859 in `block in enable'
4 /usr/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb 859 in `each'
5 /usr/lib/ruby/gems/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb 859 in `enable'
I'm guessing somehow apache2ctl lets passenger->ruby interpreter know that Im working with UTF-8, where service apache2 start doesn't, however I don't manage it to work even explicitally setting LANG=en_US.UTF-8 in /etc/init.d/apache2.
Any ideas on how to make service apache2 start work like apache2ctl start?

Thanks in advance
 
Old 12-13-2010, 10:56 AM   #2
arond
LQ Newbie
 
Registered: Dec 2009
Distribution: OpenSuse 11.3
Posts: 5

Original Poster
Rep: Reputation: 0
Solved. It seems the "/etc/init.d/apache2 start" method is not loading ruby with the encoding environment variables set properly.

For passenger to do it right we need a wrapper script /usr/local/bin/ruby_utf8:
Quote:
#!/bin/bash
exec /usr/local/bin/ruby -E utf-8:utf-8 "$@"
and then set Passenger to call that script instead of the ruby executable directly:
Quote:
LoadModule passenger_module /usr/lib/ruby/gems/1.9.1/gems/passenger-3.0.1/ext/apache2/mod\
_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.9.1/gems/passenger-3.0.1
PassengerRuby /usr/local/bin/ruby_utf8
It seems that things are running fine now.
 
  


Reply

Tags
apache, initd, ruby, utf8


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Installing Ruby on Rails -- "gem update --system is disabled on Debian". bartonski Debian 2 08-23-2009 09:17 PM
LXer: "Ruby on Rails" comprehensively renovated LXer Syndicated Linux News 0 03-17-2009 03:10 PM
fdisk reports odd "Start "and "End" sectors on single partition eponymous Linux - Software 3 10-01-2007 03:41 PM
X Server broken. start w/ "INIT: ld "x" respawning too fast: disabled for 5 minutes&q tektone Linux - Hardware 5 07-25-2007 07:18 PM
LXer: RubyConf*MI, OSCON, and"Ruby for Rails" LXer Syndicated Linux News 0 08-01-2006 11:54 PM


All times are GMT -5. The time now is 06:55 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration