mercurial is not known from apache2

soloturn at gmail.com soloturn at gmail.com
Fri Mar 2 20:09:01 CET 2007


as i'm not sure if apache2 or python is responsible for this, excuse
if i try to ask here too.

our problem is that mercurial does not work from apache, but from
python command-line it does. what could be a reason for this
behaviour?

-----------------------------------------------
from the command line it works:
-----------------------------------------------
www-data at myserver ~
$ which python
/usr/local/bin/python
www-data at myserver ~
$ echo $LD_LIBRARY_PATH
/usr/local/lib:/usr/lib:/usr/local/lib:/opt/sfw/lib
www-data at myserver ~
$ python
Python 2.5 (r25:51908, Feb 22 2007, 11:38:23)
[GCC 3.4.2] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from mercurial.hgweb.hgwebdir_mod import hgwebdir
>>> ^D
www-data at myserver ~

-----------------------------------------------
from apache-2.2.4 it does not work:
-----------------------------------------------

environment, output via:
def print_env():
    print "Content-Type: text/html\n\n";
    for name, value in os.environ.items():
        print "%s\t= %s <br/>" % (name, value)
    print sys.path

SERVER_SOFTWARE = Apache/2.2.4 (Unix) DAV/2 mod_python/3.2.10 Python/
2.5 SVN/1.4.3 mod_ssl/2.2.4 OpenSSL/0.9.8d
SCRIPT_NAME = /hg
SERVER_SIGNATURE =
REQUEST_METHOD = GET
SERVER_PROTOCOL = HTTP/1.1
QUERY_STRING =
PATH = /usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/ccs/bin:/usr/
sbin:/usr/bin:/usr/dt/bin:/usr/local/bin:/cs/local/bin:/opt/sfw/bin:/
usr/ccs/bin:/opt/VRTS/bin
HTTP_USER_AGENT = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; i-NavFourF; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
TZ = MET
SERVER_NAME = myserver
REMOTE_ADDR = 169.63.210.220
SERVER_PORT = 80
SERVER_ADDR = 169.62.140.224
DOCUMENT_ROOT = /usr/local/data/htdocs
SCRIPT_FILENAME = /usr/local/data/hg09/hgwebdir.cgi
SERVER_ADMIN = admin at example.com
HTTP_HOST = myserver
HTTP_CONNECTION = Keep-Alive
REQUEST_URI = /hg
HTTP_ACCEPT = */*
GATEWAY_INTERFACE = CGI/1.1
REMOTE_PORT = 3751
HTTP_ACCEPT_LANGUAGE = en,de-ch;q=0.7,fr;q=0.3
HTTP_ACCEPT_ENCODING = gzip, deflate
UNIQUE_ID = XnNQGqk at i@EAAB9ZBgoAAAAF
['/usr/local/data/hg09', '/usr/local/lib/python2.5/site-packages/
setuptools-0.6c3-py2.5.egg', '/usr/local/lib/python2.5/site-packages/
Genshi-0.4dev_r494-py2.5.egg', '/usr/local/lib/python2.5/site-packages/
TracAccountManager-0.1.3dev_r1844-py2.5.egg', '/usr/local/lib/
python2.5/site-packages/TracCombineWiki-1.2-py2.5.egg', '/usr/local/
lib/python2.5/site-packages/TracForge-1.0-py2.5.egg', '/usr/local/lib/
python2.5/site-packages/TracWebAdmin-0.1.2dev_r4429-py2.5.egg', '/usr/
local/lib/python2.5/site-packages/TracHTTPAuth-1.1-py2.5.egg', '/usr/
local/lib/python2.5/site-packages/IniAdmin-0.1-py2.5.egg', '/usr/local/
lib/python2.5/site-packages/LdapPlugin-0.5.1dev_r1611-py2.5.egg', '/
usr/local/lib/python2.5/site-packages/tracreposearch-0.2-py2.5.egg', '/
usr/local/lib/python2.5/site-packages/TracXMLRPC-0.1-py2.5.egg', '/usr/
local/lib/python2.5/site-packages/TracTicketDelete-1.1.4-py2.5.egg', '/
usr/local/lib/python2.5/site-packages/TracNav-3.92-py2.5.egg', '/usr/
local/lib/python25.zip', '/usr/local/lib/python2.5', '/usr/local/lib/
python2.5/plat-sunos5', '/usr/local/lib/python2.5/lib-tk', '/usr/local/
lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages']
exception output:
Python 2.5: /usr/local/bin/python
 /usr/local/data/hg09/hgwebdir.cgi in ()
   29 from mercurial.hgweb.hgwebdir_mod import hgwebdir
   30 from mercurial.hgweb.request import wsgiapplication
   31 import mercurial.hgweb.wsgicgi as wsgicgi

mercurial undefined, hgwebdir undefined
 /usr/local/lib/python2.5/site-packages/mercurial/hgweb/__init__.py in
()
    7 # of the GNU General Public License, incorporated herein by
reference.
    9 import hgweb_mod, hgwebdir_mod
   11 def hgweb(*args, **kwargs):

hgweb_mod undefined, hgwebdir_mod undefined
 /usr/local/lib/python2.5/site-packages/mercurial/hgweb/hgweb_mod.py
in ()
    7 # of the GNU General Public License, incorporated herein by
reference.
    9 import os, mimetypes, re, zlib, mimetools, cStringIO, sys
   10 import tempfile, urllib, bz2
   11 from mercurial.node import *
os = None, mimetypes = None, re = None, zlib undefined, mimetools
undefined, cStringIO undefined, sys undefined
<type 'exceptions.ImportError'>: ld.so.1: python: fatal: relocation
error: file /usr/local/lib/python2.5/lib-dynload/zlib.so: symbol
inflateCopy: referenced symbol not found

-----------------------------------------------
file system
-----------------------------------------------

# ls -l /usr/local/lib/python2.5/site-packages/mercurial/hgweb/
hgweb_mod.py*
-rw-r-----   1 www-data other      40810 Mär  2 14:13 /usr/local/lib/
python2.5/site-packages/mercurial/hgweb/hgweb_mod.py
-rw-r-----   1 www-data other      45015 Mär  2 14:34 /usr/local/lib/
python2.5/site-packages/mercurial/hgweb/hgweb_mod.pyc

-----------------------------------------------
try to manipulate LD_LIBRARY_PATH
-----------------------------------------------
if we try to set the ld_library_path in the hgwebdir.cgi via:
os.environ["LD_LIBRARY_PATH"] = "/usr/local/lib:/usr/local/lib:/opt/
sfw/lib"
the error mentioned above happens.
if we enter LD_LIBRARY_PATH in the apache2 envvars file, it seems not
to take it (it is not shown in the environment printet above). so
therefor the question if there is anything strange with apache-2.2.4.
just to check i entered a echo statement in apachectl to see if it
finds it and print the path
# apachectl restart
load envvars
/usr/local/lib:/usr/local/lib:/opt/sfw/lib

# nm /usr/local/lib/python2.5/lib-dynload/zlib.so | grep inflate
[209]   |         0|       0|FUNC |GLOB |0    |UNDEF  |inflate
[181]   |         0|       0|FUNC |GLOB |0    |UNDEF  |inflateCopy
[192]   |         0|       0|FUNC |GLOB |0    |UNDEF  |inflateEnd
[174]   |         0|       0|FUNC |GLOB |0    |UNDEF  |inflateInit2_

-----------------------------------------------
q&na (questions and no answers ..)
-----------------------------------------------
why it does work from the commandline, and not from apache-2.2.4 cgi?
seems to be same ld_library_path, same path, same python, same
mercurial.

--s




More information about the Python-list mailing list