Ich wollte heute in die Webprogrammierung mit Python einsteigen. Dafür habe ich mich für einen Apache ( WAMP Apache 2.2.8 ) mit fastCGI entschieden. Ich habe die dll von fastcgi verwendet, diese in die Modulliste eingetragen. Um fastCGI ausführen zu können hab ich folgende .htaccess verwendet.
.htaccess :
Code: Alles auswählen
Options +ExecCGI
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatcher.fcgi/$1 [QSA,L]
Code: Alles auswählen
#!C:\Python25\python.exe
# -*- coding: UTF-8 -*-
from mainapp import app
from fcgi import WSGIServer
WSGIServer(app).run()
Code: Alles auswählen
#!C:\Python25\python.exe
# -*- coding: UTF-8 -*-
from cgi import escape
import sys, os
def app(environ, start_response):
import cgi
start_response('200 OK', [('Content-Type', 'text/html')])
yield '<html><head><title>Hello World!</title></head>\n' \
'<body>\n' \
'<p>Hello World!</p>\n</body></html>\n'
Wenn ich nun den Ordner mit den 4 Dateien im Browser aufrufe, bekomme ich als Antwort: Internal Server Error 500
In den Logs sind folgende Einträge:
Code: Alles auswählen
[Sat Apr 19 20:45:50 2008] [notice] Apache/2.2.8 (Win32) PHP/5.2.5 mod_fastcgi/2.4.6 configured -- resuming normal operations
[Sat Apr 19 20:45:50 2008] [notice] Server built: Jan 18 2008 00:37:19
[Sat Apr 19 20:45:50 2008] [notice] Parent: Created child process 5060
[Sat Apr 19 20:45:50 2008] [notice] Child 5060: Child process is running
[Sat Apr 19 20:45:50 2008] [notice] Child 5060: Acquired the start mutex.
[Sat Apr 19 20:45:50 2008] [notice] Child 5060: Starting 64 worker threads.
[Sat Apr 19 20:45:50 2008] [notice] FastCGI: process manager initialized
[Sat Apr 19 20:45:50 2008] [notice] Child 5060: Starting thread to listen on port 80.
[Sat Apr 19 20:46:09 2008] [warn] FastCGI: (dynamic) server "C:/wamp/www/gw3/dispatcher.fcgi" started (pid 3248)
[Sat Apr 19 20:46:09 2008] [warn] FastCGI: (dynamic) server "C:/wamp/www/gw3/dispatcher.fcgi" (pid 3248) terminated with exit with status '1'
[Sat Apr 19 20:46:14 2008] [warn] FastCGI: (dynamic) server "C:/wamp/www/gw3/dispatcher.fcgi" restarted (pid 2952)
[Sat Apr 19 20:46:14 2008] [error] [client 127.0.0.1] (OS 109)Die Pipe wurde beendet. : FastCGI: comm with server "C:/wamp/www/gw3/dispatcher.fcgi" aborted: GetOverlappedResult() failed
[Sat Apr 19 20:46:14 2008] [warn] FastCGI: (dynamic) server "C:/wamp/www/gw3/dispatcher.fcgi" (pid 2952) terminated with exit with status '1'
[Sat Apr 19 20:46:14 2008] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "C:/wamp/www/gw3/dispatcher.fcgi"
[Sat Apr 19 20:46:15 2008] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Sat Apr 19 20:46:17 2008] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
[Sat Apr 19 20:46:19 2008] [warn] FastCGI: (dynamic) server "C:/wamp/www/gw3/dispatcher.fcgi" restarted (pid 5244)
[Sat Apr 19 20:46:19 2008] [warn] FastCGI: (dynamic) server "C:/wamp/www/gw3/dispatcher.fcgi" (pid 5244) terminated with exit with status '1'
[Sat Apr 19 20:46:19 2008] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Sat Apr 19 20:46:19 2008] [notice] Child 5060: Exit event signaled. Child process is ending.
[Sat Apr 19 20:46:20 2008] [notice] Child 5060: Released the start mutex
[Sat Apr 19 20:46:24 2008] [warn] FastCGI: (dynamic) server "C:/wamp/www/gw3/dispatcher.fcgi" restarted (pid 4596)
[Sat Apr 19 20:46:24 2008] [warn] FastCGI: (dynamic) server "C:/wamp/www/gw3/dispatcher.fcgi" (pid 4596) terminated with exit with status '1'
[Sat Apr 19 20:46:24 2008] [warn] FastCGI: (dynamic) server "C:/wamp/www/gw3/dispatcher.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 600 seconds
[Sat Apr 19 20:46:25 2008] [notice] Child 5060: All worker threads have exited.
[Sat Apr 19 20:46:26 2008] [notice] Child 5060: Child process is exiting
[Sat Apr 19 20:46:26 2008] [notice] Parent: Child process exited successfully.