[Gllug] (forw) [steve at fractalus.com: mod_ruby weirdness]

SteveC steve at fractalus.com
Mon Jun 27 16:21:38 UTC 2005


modruby list seems dead, so I'm hoping someone here on gllug has a clue
about this weird apache issue?

----- Forwarded message from SteveC <steve at fractalus.com> -----

Date: Mon, 27 Jun 2005 15:44:05 +0100
To: modruby ML <modruby at modruby.net>
User-Agent: Mutt/1.5.6+20040907i
Reply-To: modruby at modruby.net
From: SteveC <steve at fractalus.com>
Subject: mod_ruby weirdness

Hi,

I have a strange problem with apache and mod_ruby.

I'm running an up to date debian/testing box with apache2 and mod_ruby.
I have a little script which reports the mysql client version, connects
to a database and reports its version.

When I run this script on the command line it uses mysql 4.1.x and
connects fine. When I run it through apache it says 4.0.x and fails to
connect (version too old). Weird huh?

So I have two copies of libmysql client libmysqlclient12 and
libmysqlclient14 (debian packages). The former is needed by php4-mysql
and other things and connects to mysql 4.0.x. The latter is what I
compiled the ruby mysql connector against to connect to mysql 4.1.x as
the mysql ruby connector with debian is compiled against the old version
(12). We can see this with ldd that its only linked against the newer
version:

# ldd /usr/local/lib/site_ruby/1.8/i386-linux/mysql.so 
        libruby1.8.so.1.8 => /usr/lib/libruby1.8.so.1.8 (0x40018000)
        libmysqlclient.so.14 => /usr/lib/libmysqlclient.so.14 (0x400e0000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x401e8000)
        libdl.so.2 => /lib/tls/libdl.so.2 (0x401f7000)
        libcrypt.so.1 => /lib/tls/libcrypt.so.1 (0x401fa000)
        libm.so.6 => /lib/tls/libm.so.6 (0x40227000)
        libc.so.6 => /lib/tls/libc.so.6 (0x40249000)
        libnsl.so.1 => /lib/tls/libnsl.so.1 (0x4037f000)
        libz.so.1 => /usr/lib/libz.so.1 (0x40393000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

my script looks like this (replacing sensitive things with 'blah'):


#!/usr/bin/ruby
require "xmlrpc/client"
require "mysql"

MYSQL_SERVER = "blah"
MYSQL_USER = "blah"
MYSQL_PASS = "blah"
MYSQL_DATABASE = "blah"

begin
  puts Mysql.client_info()
  #connect to the MySQL server
  dbh = Mysql.real_connect(MYSQL_SERVER, MYSQL_USER, MYSQL_PASS,
MYSQL_DATABASE)
  # get server version string and display it
  puts "Server version: " + dbh.get_server_info

rescue MysqlError => e
  print "Error code: ", e.errno, "\n"
  print "Error message: ", e.error, "\n"

ensure
  # disconnect from server
  dbh.close if dbh
end


when I run from the command line I get

4.1.11
Server version: 4.1.11-Debian_4-log

When run from apache I get

4.0.24
Error code: 1251
Error message: Client does not support authentication protocol requested
by server; consider upgrading MySQL client

But strangely, apache has BOTH versions open

# lsof | grep mysqlclient
apache2   11137        root  mem       REG        8,1    243592 163524 /lib/libmysqlclient.so.12.0.0
apache2   11139    www-data  mem       REG        8,1    243592 163524 /lib/libmysqlclient.so.12.0.0
apache2   11139    www-data  mem       REG        8,1   1066312 2289645 /usr/lib/libmysqlclient.so.14.0.0
apache2   11140    www-data  mem       REG        8,1    243592 163524 /lib/libmysqlclient.so.12.0.0
apache2   11142    www-data  mem       REG        8,1    243592 163524 /lib/libmysqlclient.so.12.0.0
apache2   11371    www-data  mem       REG        8,1    243592 163524 /lib/libmysqlclient.so.12.0.0
apache2   11616    www-data  mem       REG        8,1    243592 163524 /lib/libmysqlclient.so.12.0.0
apache2   11668    www-data  mem       REG        8,1    243592 163524 /lib/libmysqlclient.so.12.0.0
apache2   11669    www-data  mem       REG        8,1    243592 163524 /lib/libmysqlclient.so.12.0.0
apache2   11785    www-data  mem       REG        8,1    243592 163524 /lib/libmysqlclient.so.12.0.0
apache2   11894    www-data  mem       REG        8,1    243592 163524 /lib/libmysqlclient.so.12.0.0
apache2   11900    www-data  mem       REG        8,1    243592 163524 /lib/libmysqlclient.so.12.0.0


here's what the libs look like:

# ls -l /usr/lib/*mysql*
-rw-r--r--  1 root root 1219050 May 23 00:22 /usr/lib/libmysqlclient.a
-rw-r--r--  1 root root     859 May 23 00:22 /usr/lib/libmysqlclient.la
lrwxr-xr-x  1 root root      20 Jun 27 12:55 /usr/lib/libmysqlclient.so -> libmysqlclient.so.14
-rw-r--r--  1 root root 1066312 Jun 27 15:00 /usr/lib/libmysqlclient.so.12.0.0
lrwxr-xr-x  1 root root      24 Jun 21 09:45 /usr/lib/libmysqlclient.so.14 -> libmysqlclient.so.14.0.0
-rw-r--r--  1 root root 1066312 May 23 00:22 /usr/lib/libmysqlclient.so.14.0.0
-rw-r--r--  1 root root 1228096 May 23 00:22 /usr/lib/libmysqlclient_r.a
-rw-r--r--  1 root root     893 May 23 00:22 /usr/lib/libmysqlclient_r.la
lrwxr-xr-x  1 root root      22 Jun 27 12:55 /usr/lib/libmysqlclient_r.so -> libmysqlclient_r.so.14
lrwxr-xr-x  1 root root      26 Jun 21 09:45 /usr/lib/libmysqlclient_r.so.12 -> libmysqlclient_r.so.12.0.0
-rw-r--r--  1 root root  251880 May 18 08:07 /usr/lib/libmysqlclient_r.so.12.0.0
lrwxr-xr-x  1 root root      26 Jun 21 09:45 /usr/lib/libmysqlclient_r.so.14 -> libmysqlclient_r.so.14.0.0
-rw-r--r--  1 root root 1073512 May 23 00:22 /usr/lib/libmysqlclient_r.so.14.0.0
-rw-r--r--  1 root root 8844326 May 23 00:22 /usr/lib/libmysqld.a


I would really like apache or mod_ruby or whatever to select the correct
damn libmysqlclient. How can I do this?

TIA!

have fun,

SteveC steve at fractalus.com http://www.fractalus.com/steve/



----- End forwarded message -----

have fun,

SteveC steve at fractalus.com http://www.fractalus.com/steve/
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list