es ist mir schon fast peinlich, aber ich weiß nichtmehr weiter.
Ich habe mir unter Ubuntu Edgy(6.10) Apache2 installiert. Aber ich bekomme Python weder mit mod_python(wieso wird im Forum merfach davon abgeraten, wenn es doch schneller als cgi ist?), noch mit cgi zum laufen..
Code: Alles auswählen
#Eintrag im apache2.conf
cat /etc/apache2/apache2.conf
[...]<Directory /var/www>
Options +ExecCGI
AddHandler cgi-script .cgi .py .pcy .pyo
</Directory>
#das cgi Skript
cat /var/www/apache2-default/cgi.py
#!/usr/bin/python
#-*-Encoding: utf-8 -*-
print "Content-type: text/html\n\n";
print "Hello, World.";
Auch mit mod_python funzt es nicht, da will er die Datei dann runterladen. Das Modul wird geladen:
Code: Alles auswählen
cat /etc/apache2/mods-enabled/mod_python.load
LoadModule python_module /usr/lib/apache2/modules/mod_python.so
Code: Alles auswählen
cat /etc/apache2/apache2.conf
<Directory /var/www>
AddHandler mod_python .py .pyc .pyo
PythonDebug On
</Directory>
ls -l auf die Datei sagt mir folgendes(vielleicht liegt ja auch in den Rechten der Fehler und ich weiß es nur nich, dass ich was anderes als 755 nehmen muss

Code: Alles auswählen
ls -l cgi.py
-rwxr-xr-x 1 root root 102 2007-03-28 21:33 cgi.py
Edit:
Ich habs jetz noch weiter mit mod_python probiert und mir eine /etc/apache/mods-enabled/mod_python.conf angelegt:
Code: Alles auswählen
<IfModule mod_python.c>
AddHandler mod_python .py .pyc .pyo
PythonHandler mod_python.publisher
PythonDebug On
</IfModule>
##Nochma die apache.conf
<Directory /var/www>
AddHandler mod_python .py .pyc .pyo
AddHandler python-program .py .pyc .pyo
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
Code: Alles auswählen
[Wed Mar 28 22:06:06 2007] [notice] mod_python: Creating 8 session mutexes based on 6 max processes and 25 max threads.
[Wed Mar 28 22:06:06 2007] [notice] Apache/2.0.55 (Ubuntu) mod_python/3.2.8 Python/2.4.4c1 configured -- resuming normal operations
[Wed Mar 28 22:06:08 2007] [notice] mod_python: (Re)importing module 'mod_python.publisher'
[Wed Mar 28 22:06:09 2007] [notice] [client 127.0.0.1] Publisher loading page /var/www/apache2-default/cgi.py
Code: Alles auswählen
[Wed Mar 28 21:06:17 2007] [error] [client 127.0.0.1] Options ExecCGI is off in this directory: /var/www/apache2-default/test.cgi
Code: Alles auswählen
<Directory /var/www>
Options +ExecCGI
AddHandler cgi-script .cgi .py .pcy .pyo
</Directory>
Achja: Auch mit folgendem Skript geht es nicht:
Code: Alles auswählen
#!/usr/bin/python
#-*-Encoding: utf-8-*-
from mod_python import apache
def handler(req):
req.write("Hello World!")
return apache.OK

Und bevor ichs vergess

Code: Alles auswählen
python -V
Python 2.4.4c1