Stackless python stopped mod_python/apache from working - python

I installed stackless pyton 2.6.2 after reading several sites that said its fully compatible with vanilla python. After installing i found that my django applications do not work any more.
I did reinstall django (1.1) again and now im kind of lost. The error that i get is 500:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.11 (Ubuntu) DAV/2 PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch mod_python/3.3.1 Python/2.6.2 mod_ruby/1.2.6 Ruby/1.8.7(2008-08-11) mod_ssl/2.2.11 OpenSSL/0.9.8g Server at 127.0.0.1 Port 80
What else, could or should i do?
Edit: From 1st comment i understand that the problem is not in django but mod_python & apache? so i edited my question title.
Edit2: I think something is wrong with some paths setup. I tried going from mod_python to mod_wsgi, managed to finally set it up correctly only to get next error:
[Sun Aug 16 12:38:22 2009] [error] [client 127.0.0.1] raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
[Sun Aug 16 12:38:22 2009] [error] [client 127.0.0.1] ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
Alan

When you install a new version of Python (whether stackless or not) you also need to reinstall all of the third party modules you need -- either from sources, which you say you don't want to do, or from packages built for the new version of Python you've just installed.
So, check the repository from which you installed Python 2.6.2 with aptitude: does it also have versions for that specific Python of mod_python, mysqldb, django, and any other third party stuff you may need? There really is no "silver bullet" for package management and I know of no "sumo distribution" of Python bundling all the packages you could ever possibly need (if there were, it would have to be many 10s of GB;-).

Related

OSError: Cannot load native module 'Crypto.Cipher._raw_ecb' on Apache mod_wsgi CentOS 8

I'm trying to run a django project on an apache server. The django server runs fine on its own but fails when running through mod_wsgi. It returns the error as follow :
OSError: Cannot load native module 'Crypto.Cipher._raw_ecb': Trying '_raw_ecb.cpython-39-x86_64-linux-gnu.so': /home/user/django/centos_env/lib/python3.9/site-packages/Cryptodome/Util/../Cipher/_raw_ecb.cpython-39-x86_64-linux-gnu.so: failed to map segment from shared object,
Trying '_raw_ecb.abi3.so': /home/user/django/centos_env/lib/python3.9/site-packages/Cryptodome/Util/../Cipher/_raw_ecb.abi3.so: cannot open shared object file: No such file or directory,
Trying '_raw_ecb.so': /home/user/django/centos_env/lib/python3.9/site-packages/Cryptodome/Util/../Cipher/_raw_ecb.so: cannot open shared object file: No such file or directory
I checked that the file were there. I checked Python home variable and tried to import Crypto.Cipher from the python interpreter(which worked). Everything seems fine.
I tried to compile pycryptodome from source but it didn't help either.
I had the same problem (I'm on Gentoo-Linux) with flask.
Reason were different versions of Python in the virtual environment and mod_wsgi compiled against.
You can see the version of mod_wsgi when you restart apache and look into the error_log, something like
AH00163: Apache/2.4.46 (Unix) OpenSSL/1.1.1i PHP/7.2.34 mod_wsgi/4.7.1 Python/3.7 configured -- resuming normal operations
shows the version Python mod_wsgi was compiled against.
My virtual environment used Python 3.7 while mod_wsgi was on 3.8 .

How do I delete mod_python?

I keep getting these errors in my Apache logs:
[error] python_init: Python version mismatch, expected '2.6.5+', found '2.6.6'.
[error] python_init: Python executable found '/usr/bin/python'.
[error] python_init: Python path being used '/usr/lib/python2.6/:/usr/lib/python2.6/plat-linux2:/usr/lib/python2.6/lib-tk:/usr/lib/python2.6/lib-old:/usr/lib/python2.6/lib-dynload'.
[notice] mod_python: Creating 8 session mutexes based on 150 max processes and 0 max threads.
[notice] mod_python: using mutex_directory /tmp
From what I've read, these errors come from mod_python. I'm using Flask and WSGI for my Python project, however, so I don't know why these errors are coming up.
Is there an easy way I can delete mod_python? - I've tried a2dismod, but mod_python doesn't appear to exist, even though I see it within Apache's mods-available directory.
EDIT: I've just tried a2dismod python, and that seems to have worked. I think I n00bishly was trying to disable mod_python. My Python apps still appear to work just fine.
Thanks in advance!
Look through your httpd.conf file, and remove the line that says:
LoadModule mod_python /path/to/mod_python.so
Then restart apache:
apachectl restart

Internal Server error while using Python OpenId with Google Authentication

I have installed askbot.org on my local machine and When I tri to use google openid, I get following error. Here is full apache log. (I have replaced some hex strings)
http://bit.ly/apache_log
Can someone explain to me what could be problem ?
From your log, this seems to be the big issue:
[Wed Mar 07 22:58:13 2012] [error] Received "invalidate_handle" from server
From the answer to this question on invalidate_handle, it looks like a bug in the "Relying Party". I would double-check your configuration.

Python 2.6 threading KeyError with Apache

I'm running Apache, installed using macports on OS X, to serve a Django app.
I'm getting many lines in the Apache error_log like these:
[Wed Feb 23 11:35:42 2011] [error] Exception KeyError: KeyError(-1606572256,) in <module 'threading' from '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.pyc'> ignored
The server doesn't seem to be having noticeable problems while these errors are logged, but it does crash every so often requiring a manual restart - which may or may not be related to these error messages.
Any ideas?
That bug is almost a year old. Update mod_wsgi.

Segmentation Fault (11) on httpd when python-ldap is initialized

I'm using mod_wsgi for a Django application (OSQA) on RHEL 5 with Python 2.43 (cannot upgrade).
I had the site set up and working fine, and then tried to integrate the authentication with python-ldap for accessing Active Directory attributes e.g. a user's name, email address etc.
Apache httpd crashes with the following message:
[notice] child pid 18705 exit signal Segmentation fault (11)
I originally thought this was due to inconsisten expat libraries between Apache and Python, but I have since upgraded the libexpat.so module to match the Python version of pyexpat (1.95.8).
From heavy logging in the django log, I can see the seg fault occurs when this line is executed:
con = ldap.initialize(AD_LDAP_URL)
Is there something specific with python-ldap causing this issue? Any other thoughts on how to debug?
Thanks
Try disabling any Apache modules for auth which use LDAP. Also try disabling mod_php if being used and it is loading a LDAP extension. In short, library version conflict may be because of LDAP libraries rather than expat, so disable the other Apache modules and see if problem goes away. That will narrow it down.

Categories

Resources