Bonjour à tous,

Je veux utiliser pour la première fois un script cgi sur un serveur WEB ! sur ma raspberry Pi mais cela ne veut pas fonctionner !!!

apache renvoit tjrs l'erreur :
Internal Server Error

Voila j'ai installé apache qui fonctionne correctement ensuite j'ai placé dans le repertoire cgi-bin un fichier test.py et un fichier index.html dans var/www

fichier html
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
<html>
<head><title>KBOT</title></head>
<body>
<form action='cgi-bin/test.py' method='post'><input type='text' name='post'><input type='submit'></form>
</body>
</html>
fichier .py
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python

import cgi
import cgitb

cgitb.enable()

print "Content-type: text/html\n\n"

form=cgi.FieldStorage()

if "post" not in form:
    print "<h1>The text area was empty.</h1>"
else:
    text=form["post"].value
    print "<h1>Text from text input:</h1>"
    print cgi.escape(text)
Ensuite j'ai modifié mon fichier de configuration apache par défaut en faisant :

nano /etc/apache2/sites-available/default :

j'ai ajouté les extensions .py


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                AddHandler cgi-script cgi pl py
                Order allow,deny
                Allow from all
        </Directory>

redemmarré le service apache2 ! j'ai mm testé en faisant un chmod +x test.py !!

j'ai suivi plusieurs tutoriaux mais je reste coincé ;-)

J'ai bien les modules python et cgi d'installé !

root@raspberrypi:~# a2enmod python
Module python already enabled
root@raspberrypi:~# a2enmod cgi
Your MPM seems to be threaded. Selecting cgid instead of cgi.


Cordialement,
bypbop