[Tutor] setting environment variables in apache

Suzanne Little s349929@student.uq.edu.au
Tue, 15 May 2001 09:26:39 +1000 (GMT+1000)


Hello,

I'm still working on a problem that I posted here a few weeks back.
Briefly I can't import the MySQLdb module when the script is put on the
apache web server.
I'm pretty sure that the problem is setting my LD_LIBRARY_HOME path but
can't manage to do this for the server. At the end is the test script
I'm running to try and get the module to import correctly and the errors
I'm getting.

I know that it's using the right version of python (2.0) and that it's the
right module and the paths are correct. I can log onto the machine that's
running the server and import MySQLdb from a command line no problems.
According to the faqts site I'm setting the environment variables
correctly so I don't know what else to do.

How do I set the environment variable for the script in apache?

Thanks,
Suzanne

-----------------------------------------
#!/usr/local/bin/python2.0

def wisp():
    import os
    print "Content-Type: text/html"
    print
    print '<html>'
    os.environ['LD_LIBRARY_PATH'] = '/opt/local/lib:/opt/local/lib/mysql'
    print os.environ['LD_LIBRARY_PATH']
    print '<br>'
    import MySQLdb
    print dir(MySQLdb)
    print '<br>DONE'
    print '</html>'

if __name__ == '__main__':
    wisp()
----
Traceback (most recent call last):
  File
"/.../bootup3.py", line
17, in ?
    wisp()
  File
"/.../bootup3.py", line
11, in wisp
    import MySQLdb
  File "/usr/local/lib/python2.0/site-packages/MySQLdb.py", line 19, in ?
    import _mysql
ImportError: ld.so.1: /usr/local/bin/python2.0: fatal:
libmysqlclient.so.6: open failed: No such file or directory


--------------------------------------------------------------------------
"Contrariwise," continued Tweedledee, "If it was so, it might be; and if
it were so, it would be; but as it isn't, it ain't.  That's logic"
                             -Lewis Carroll
--------------------------------------------------------------------------