Passenger and ruby-oci8 (Oracle)

Oracle is going to drive a man to drink.  After getting our rake migrations to run with this solution, our application had issues.  We run our Rails app in Passenger + Apache2.  After we deployed, we got this error:

ERROR: ActiveRecord oracle_enhanced adapter could not load ruby-oci8 library. Please install ruby-oci8 gem.

As it turns out, Passenger does not pick up the LD_LIBRARY_PATH and the only way I’m aware of set it is to create a wrapper for the ruby binary.  To fix this, create the file /usr/local/bin/passenger-ruby:

#!/bin/sh
 
export LD_LIBRARY_PATH=/opt/oracle/instantclient_11_2
exec "/usr/bin/ruby" "$@"

Then update passenger.conf and change PassengerRuby to:

PassengerRuby /usr/local/bin/passenger-ruby

Don’t forget to restart Apache. Good luck.

This entry was posted in Technology and tagged , , , , . Bookmark the permalink.

One Response to Passenger and ruby-oci8 (Oracle)

  1. Avin Tokade says:

    Thanks for the post…
    I have same above issue with passenger (3.0.0)latest version.

    I have installed RVM with single user mode.
    /home/deploy/.rvm/rubies/ruby-1.9.2-p0/bin/ruby

    And my passenger.conf has already path define for ‘passenger-ruby’ file. and this file has already following code.

    #!/usr/bin/env bash
    if [[ -s "/home/passenger/.rvm/environments/ruby-1.9.2-p0" ]] ; then
    source “/home/passenger/.rvm/environments/ruby-1.9.2-p0″
    exec ruby “$@”
    else
    echo “ERROR: Missing RVM environment file: ‘/home/passenger/.rvm/environments/ruby-1.9.2-p0′” >&2
    exit 1
    fi

    Please help me to add LD_LIBRARY_PATH in this file.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">