473,587 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Problem with MySQLdb and mod_python

In message <ma************ *************** *********@pytho n.org>, Cyril Bazin
wrote:
But it seems, after many tests, that the script stops at the
instruction : "c.execute(requ ete)"
What's the error message? This should be in Apache's error_log file.
Jul 17 '08 #1
3 1873
Thanks for your reply

The apache log contains lines like :

[Tue Jul 15 23:31:01 2008] [notice] mod_python (pid=11836,
interpreter='ww w.toto.fr'): Importing module
'/usr/local/apache2/htdocs/intranet/courrier/test.py'
[Tue Jul 15 23:31:02 2008] [notice] child pid 11836 exit signal
Segmentation fault (11)
[Tue Jul 15 23:31:19 2008] [notice] mod_python (pid=11764,
interpreter='ww w.toto.fr'): Importing module
'/usr/local/apache2/htdocs/intranet/courrier/test.py'
[Tue Jul 15 23:31:19 2008] [notice] child pid 11764 exit signal
Segmentation fault (11)

I think the problem comes from the MySQLdb module.
If I can't find another solution, I think I will downgrade the MySQLdb
version to 1.2.1

Cyril

On Thu, Jul 17, 2008 at 7:27 AM, Lawrence D'Oliveiro
<ld*@geek-central.gen.new _zealandwrote:
In message <ma************ *************** *********@pytho n.org>, Cyril Bazin
wrote:
>But it seems, after many tests, that the script stops at the
instruction : "c.execute(requ ete)"

What's the error message? This should be in Apache's error_log file.
--
http://mail.python.org/mailman/listinfo/python-list
Jul 17 '08 #2
Cyril Bazin wrote:
Thanks for your reply

The apache log contains lines like :

[Tue Jul 15 23:31:01 2008] [notice] mod_python (pid=11836,
interpreter='ww w.toto.fr'): Importing module
'/usr/local/apache2/htdocs/intranet/courrier/test.py'
[Tue Jul 15 23:31:02 2008] [notice] child pid 11836 exit signal
Segmentation fault (11)
[Tue Jul 15 23:31:19 2008] [notice] mod_python (pid=11764,
interpreter='ww w.toto.fr'): Importing module
'/usr/local/apache2/htdocs/intranet/courrier/test.py'
[Tue Jul 15 23:31:19 2008] [notice] child pid 11764 exit signal
Segmentation fault (11)

I think the problem comes from the MySQLdb module.
If I can't find another solution, I think I will downgrade the MySQLdb
version to 1.2.1
Sounds like version hell. mod_python and MySQLdb have to be
compiled with exactly the same compiler for this to work.

mod_python is usually troublesome. Python doesn't really have
quite enough isolation to run multiple unrelated instances reliably.
We use FCGI, which has the isolation of CGI but doesn't reload the
application for every transaction. Also, it's easier to debug if
CPython is crashing.

John Nagle
Jul 18 '08 #3
On Jul 18, 3:28*pm, John Nagle <na...@animats. comwrote:
Cyril Bazin wrote:
Thanks for your reply
The apache log contains lines like :
[Tue Jul 15 23:31:01 2008] [notice]mod_python(pid= 11836,
interpreter='ww w.toto.fr'):Imp orting module
'/usr/local/apache2/htdocs/intranet/courrier/test.py'
[Tue Jul 15 23:31:02 2008] [notice] child pid 11836 exit signal
Segmentation fault (11)
[Tue Jul 15 23:31:19 2008] [notice]mod_python(pid= 11764,
interpreter='ww w.toto.fr'):Imp orting module
'/usr/local/apache2/htdocs/intranet/courrier/test.py'
[Tue Jul 15 23:31:19 2008] [notice] child pid 11764 exit signal
Segmentation fault (11)
I think the problem comes from the MySQLdb module.
If I can't find another solution, I think I will downgrade the MySQLdb
version to 1.2.1

* * Sounds like version hell. *mod_python and MySQLdb have to be
compiled with exactly the same compiler for this to work.
Use of compatible compilers applies to anything you want to use
together. This is nothing specific to mod_python, so this comment is a
bit misleading. These days with with GNU C everywhere, it is hardly
and issue, and was usually only an issue with C++ code and not C code
anyway.
* *mod_python is usually troublesome. * Python doesn't really have
quite enough isolation to run multiple unrelated instances reliably.
The isolation issue is nothing to do with Python itself. Isolation is
an issue in this case, but most likely comes about because the OP is
trying to use both PHP and mod_python together in the same Apache
instance.

In particular, the PHP package is likely loading a MySQL module and it
is linked against a different version of the MySQL client libraries
than what the Python MySQL package is wanting.

People like to blame mod_python for these problems, but it can equally
be attributed to PHP. In practice the reason it shows up as a
mod_python issue is that PHP tries to preload a lot of stuff and so
manages to load its version of shared libraries first. Python with its
lazy loading comes in second, and so conflicts will occur. If
mod_python preloaded stuff like PHP did and this was occurring before
PHP got a chance, it would be the other way around and mod_python
would work fine and PHP would instead be what crashes all the time.
We use FCGI, which has the isolation of CGI but doesn't reload the
application for every transaction. *Also, it's easier to debug if
CPython is crashing.
With the reason that FCGI works being that the processes, even if they
are spawned by Apache, use a fork/exec, thus meaning they have a clean
memory space when starting up.

In summary, look at what version of MySQL libraries are used by PHP
modules and ensure that Python MySQL module is compiled against the
same version.

Graham
Jul 18 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2579
by: Peter Nikolaidis | last post by:
Greetings, I am attempting to get MySQLdb 0.9.2 installed on Mac OS 10.2 with a Fink distribution of Python 2.2.2. I have seen only a few posts on the subject, some of them relate to "conflicting header files," but I don't know what to do about conflicting header files, or where I would find them, and once I found them, which ones to...
2
2185
by: ws Wang | last post by:
MySQLdb is working fine at command line, however when I tried to use it with mod_python, it give me a "server not initialized" error. This is working fine: ----------------------- testmy.py ------------------------------- #!/usr/bin/python import MySQLdb db = MySQLdb.connect(host="localhost", user="root", passwd="mypass", db="my_db")...
0
1071
by: scott | last post by:
AIUI, global variables are supposed to be preserved within each Apache thread/prcoess. However, I'm importing and using MySQLdb within a class in a separate module, which is in turn imported and used within a _function (ie. not "published"). So, AFAICT, it's not supposed to be preseved. But unless I specifically close() the database...
3
2498
by: David Mitchell | last post by:
Hello, I am a complete beginner with Python. I've managed to get mod_python up and running with Apache2 and I'm trying to a simple insert into a table in a MySQL database. I'm using the MySQLdb library for connectivity. I can read from the database no problem, but when I do an insert, the value never gets added to the database, even...
2
3298
by: exhuma.twn | last post by:
Hi again, as soon as I try to make use of the "session" object inside a psp-template file, I get the following error: Mod_python error: "PythonHandler mod_python.publisher" Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
7
1212
by: John Salerno | last post by:
My web server told me it isn't, which is why they are sticking with MySQL 4.0 for now, but I'm obsessed with using the latest versions, so I just want to be sure. According to the mysqldb download page at sourceforge, it is compatible with 5.0 Thanks.
4
1449
by: elmo | last post by:
Hello, after two days of failed efforts and googling, I thought I had better seek advice or observations from the experts. I would be grateful for any input. We have various small internal web applications that use utf-8 pages for storing, searching and retrieving user input. They have worked fine for years with non ASCII values, including...
7
1816
by: Ben Finney | last post by:
Howdy all, I'm working on a web application that is starting to gain a lot of back-end code written in Python. However, all the current interface code is written in legacy PHP. I'd like to slowly introduce new features as Python WSGI programs. Is it possible to write a Python WSGI program that talks to a PHP program as its "back end"?...
113
5225
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside the Python world, you're fine. But once you do, things go downhill. MySQLdb has version and platform compatibility problems. So does M2Crypto. ...
0
7918
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.