MySQLdb - possible without install?

Gerhard Häring gerhard.nospam at bigfoot.de
Fri Jul 13 06:13:50 CEST 2001


On Thu, 12 Jul 2001 22:34:46 GMT, Ken <ken_chiba at hotmail.com> wrote:
>Thanks for your continued help...  I'm hitting a wall:  I've compiled MySQLdb
>(on python 1.5.2) -- I believe that's what my ISP's using, and I have the
>files I (think I) need:
>
>_mysql.so
>_mysql_exceptions.py(c)
>MySQLdb
>  - lots of files, and 'constants' within.
>
>I've copied these three files, plus the MySQLdb directory to the
>cgi-bin directory on the host.  I placed a simple python script in the
>cgi-bin directory that just has:
>
>#!/usr/contrib/bin/python  (the python path)
>import MySQLdb
>print "Content-Type: text/html\n\n" (so the browser doesn't choke).

Should be ok so far.

>I get a server 500 message, and checking the error_log file, I get:
>
>Traceback (innermost last):
>  File "test.cgi", line 4, in ?
>    import MySQLdb
>  File "MySQLdb/__init__.py", line 27, in ?
>    import _mysql
>ImportError: File not found
>[Thu Jul 12 17:25:48 2001] [error] [client 206.47.244.60] Premature
>end of script headers: /usr/home/v1/a0005722/html/cgi-bin/test.cgi

It looks suspiciously like a problem with file permissions. You should check
that _mysql.so has read and execute permissions for "others". Taking away both
I could reproduce the above error message.

In fact, any files in the cgi-bin directory need to be readable by others,
because the webserver usually does run under a different user and group id.

>I've placed a copy of _mysql.so in both the root cgi-bin directory,
>and into the MySQLdb directory (since __init__.py is located there).
>But no luck!  I looked for a _mysql file (without the .so), but could
>not find one.

That's not the problem. The file is really called _mysql.so and only needs to
be in the cgi-bin directory.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://highqualdev.com              public key at homepage
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))



More information about the Python-list mailing list