mod_python with xampp

Problems with the Linux version of XAMPP, questions, comments, and anything related.

mod_python with xampp

Postby Oliv7 » 19. April 2008 13:45

Hi,

I am trying to run mod_python with xampp under ubuntu hardy. I succeed in building mod_python with the following code (see below).

I load the mod_python.so as I could see it while browsing empty directory.

But I am unable to execute .py file.

I added that in a .htaccess file of the .py directory :
Code: Select all
AddHandler mod_python .py
   PythonHandler python
   PythonDebug On

And I still get 500 internal error while browsing the test.py file
Code: Select all
from mod_python import apache
def handler(req):
   req.content_type = \"text/html\"
   req.write(\"<html><head></head><body>\")
   req.write(\"<h1>Python is running with mod_python...</h1>\")
   return apache.OK


Apache error log gives me that:
ImportError: No module named mod_python.apache
[Sat Apr 19 12:32:20 2008] [error] make_obcallback: Python path being used "['/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/Numeric', '/usr/lib/python2.5/site-packages/gst-0.10', '/var/lib/python-support/python2.5', '/usr/lib/python2.5/site-packages/gtk-2.0', '/var/lib/python-support/python2.5/gtk-2.0']".
[Sat Apr 19 12:32:20 2008] [error] get_interpreter: no interpreter callback found.
[Sat Apr 19 12:32:20 2008] [error] [client 127.0.0.1] python_handler: Can't get/create interpreter., referer: http://localhost/python/

Code of the building script of mod_python for xampp is executed with no errors:

Code: Select all
sudo apt-get install build-essential
sudo rm -r /opt/lampp
sudo tar -xzvf xampp-linux-1.5.4a.tar.gz -C /opt
sudo tar -xzvf xampp-linux-devel-1.5.4a.tar.gz -C /opt
sudo rm -r Python-2.5.2
tar -xzvf Python-2.5.2.tgz
export LD_LIBRARY_PATH=/opt/lampp/lib:/usr/lib/:/usr/local/lib:/var/lib
cd Python-2.5.2
./configure --prefix=/opt/lampp/ --exec-prefix=/opt/lampp/ --enable-shared
make
sudo make install
cd ..
sudo rm -r mod_python-3.3.1
sudo rm -r release-2-6-4
#svn co https://svn.apache.org/repos/asf/quetzalcoatl/mod_python/branches/release-2-6-4
tar -xzvf mod_python-3.3.1.tgz
cd mod_python-3.3.1
./configure --prefix=/opt/lampp/ --with-apxs=/opt/lampp/bin/apxs --with-python=/opt/lampp/bin/python2.5 --with-mutex-dir=/opt/lampp/var/run/mod_python --bindir=/opt/lampp/bin --sbindir=/opt/lampp/sbin --sysconfdir=/opt/lampp/etc  --localstatedir=/opt/lampp/var --libdir=/opt/lampp/lib --includedir=/opt/lampp/include
make
sudo make install
sudo echo "Include etc/python.conf" >> /opt/lampp/etc/httpd.conf
sudo echo "LoadModule python_module modules/mod_python.so

<Directory \"/opt/lampp/htdocs/python\">
PythonPath \"['/opt/lampp/htdocs/python']+sys.path\"

AddHandler mod_python .py
PythonHandler python
PythonDebug On
</Directory>" > /opt/lampp/etc/python.conf

sudo mkdir /opt/lampp/htdocs/python
sudo echo "from mod_python import apache
def handler(req):
   req.content_type = \"text/html\"
   req.write(\"<html><head></head><body>\")
   req.write(\"<h1>Python is running with mod_python...</h1>\")
   return apache.OK" > /opt/lampp/htdocs/python/test.py
   


Any Ideas ?

@+Oliv
Oliv7
 
Posts: 12
Joined: 05. April 2008 12:11
Location: Le Havre France

Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 1 guest