PHP Forum

PHP Forum (http://www.selfphp.de/forum/index.php)
-   Apache HTTP-Server (http://www.selfphp.de/forum/forumdisplay.php?f=23)
-   -   python als apache2 modul will nicht (http://www.selfphp.de/forum/showthread.php?t=10919)

feuervogel 05.07.2005 23:05:26

python als apache2 modul will nicht
 
hi!

da man ja offen für alles sein sollte, habe ich mir mal libapache2-mod-python2.3 installiert (debian sarge). apache2 stop/start lief problemlos, habe dann mal eine datei versuch.py angelegt...wenn ich sie im browser aufrufe will er sie einfach nur runterladen (der server versteht also nicht ganz, was er damit anfangen soll). auch wenn ich in die kopfzeile

#! /usr/bin/python

schreibe und die datei für alle ausführbar mache, bringts nüscht. im ordner /etc/apache2/mods-enabled/ steht auch

lrwxrwxrwx 1 root root 33 2005-07-05 18:16 mod_python.load -> ../mods-available/mod_python.load

drin...wie heißt noch mal die datei für den apache2, wo drin steht, was er mit dateien mit der endung .py machen soll? wahrscheinlich in der gleichen wo das für php-dateien drin steht, nur welche war das noch mal?

danke für die antworten!

xabbuh 05.07.2005 23:09:40

AW: python als apache2 modul will nicht
 
Für php-Dateien brauchst du folgende Zeilen in der httpd.conf:
Code:

AddType application/x-http-php .php
AddType application/x-http-php-source .phps

Zitat:

Zitat von feuervogel
auch wenn ich in die kopfzeile

#! /usr/bin/python

schreibe und die datei für alle ausführbar mache, bringts nüscht

Befinden sich die entsprechenden Datei denn in diesem Verzeichnis?

feuervogel 05.07.2005 23:24:24

AW: python als apache2 modul will nicht
 
julian@pc:~$ ls -l /usr/bin/ | grep python
lrwxrwxrwx 1 root root 23 2005-05-08 00:55 pdb2.3 -> ../lib/python2.3/pdb.py
lrwxrwxrwx 1 root root 9 2005-05-06 22:39 python -> python2.3
-rwxr-xr-x 1 root root 983480 2005-05-04 09:09 python2.3

das meinst du, oder?

wenn ich in die /etc/apache2/httpd.conf reingucke, sehe ich das:

julian@pc:~$ cat /etc/apache2/httpd.conf
# This is here for backwards compatability reasons and to support
# installing 3rd party modules directly via apxs2, rather than
# through the /etc/apache2/mods-{available,enabled} mechanism.
#
#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so

mehr nicht...die httpd.conf wird doch für apache2 nicht mehr benutzt, oder irre ich mich?

xabbuh 05.07.2005 23:50:10

AW: python als apache2 modul will nicht
 
Zitat:

Zitat von feuervogel
mehr nicht...die httpd.conf wird doch für apache2 nicht mehr benutzt, oder irre ich mich?

Also bei mir wird auch beim Apache2 die httpd.conf benutzt, wenn ich mich jetzt nicht komplett irre.

feuervogel 05.07.2005 23:54:31

AW: python als apache2 modul will nicht
 
oh, hm, naja, ich frag vielleicht mal direkt in nem debianforum nach...trotzdem danke für die hilfe!

bazubi 06.07.2005 10:34:13

AW: python als apache2 modul will nicht
 
Man kann das auch in httpd.conf schreiben. Der Apache nutzt die auch, aber man sollte es halt in die andere Datei schreiben.

Das muss übrigens rein damit Python geht:

Code:

AddHandler mod_python .psp .psp_
Ansonsten kann ich nur sagen: Viel Spaß mit Python, das rockt richtig. Aber besser noch als PSP (Python Server Pages) ist Python außerhalb des Webservers.

c4 06.07.2005 10:39:01

AW: python als apache2 modul will nicht
 
Ohne eine großartige Diskussion lostreten zu wollen: was kann Python, was PHP (oder auch Perl) nicht kann? Warum nutzt man es? Stärken/Schwächen, Unterschiede, Links dazu?

xabbuh 06.07.2005 12:06:19

AW: python als apache2 modul will nicht
 
Zitat:

Zitat von bazubi
Man kann das auch in httpd.conf schreiben. Der Apache nutzt die auch, aber man sollte es halt in die andere Datei schreiben.

Welche andere Datei wäre das denn im Apache2?

bazubi 06.07.2005 13:05:13

AW: python als apache2 modul will nicht
 
Ich hab gerade keinen Apache2 auf Debian da, aber entweder wars die mod.conf oder httpd.conf.local. Welche genau ist eigentlich wurscht, hauptsache sie wird in die httpd.conf includiert.

feuervogel 06.07.2005 13:13:06

AW: python als apache2 modul will nicht
 
ich habe jetzt folgendes in der httpd.conf stehen:

AddHandler mod_python .py

aber trotzdem wird mir die datei.py zum download angeboten (ja, apache hab ich neugestartet)

Zitat:

Zitat von c4
Ohne eine großartige Diskussion lostreten zu wollen: was kann Python, was PHP (oder auch Perl) nicht kann? Warum nutzt man es? Stärken/Schwächen, Unterschiede, Links dazu?

okay, kurz gesagt:

python wurde entwickelt, um lesbar zu sein. anweisungsblöcke stehen nicht in {}, sondern werden eingerückt. die anweisungen werden möglichst in sprechenden worten gehalten (z.b. kam bei || in ner if-bedingung ein error, es _muss_ or heißen)...es dürfte ein wenig schneller sein als php (vor allem was oop angeht, wobei das mit php5(.1) auch wieder so ne sache ist)...mehr fällt mir grade nicht ein. musste da halt fürs studium was kleines machen und es gefiel mir auf anhieb.

empfehlen kann ich folgende lektüre (gratis ebook):

http://www.diveintopython.org/


Alle Zeitangaben in WEZ +2. Es ist jetzt 17:13:42 Uhr.

Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.