Ajout de Perl pour Apache

apt-get install libapache2-mod-perl2

Configuration pour chaque vhost

   ScriptAlias /cgi-bin/ /home/www/cgi-bin/
   <Directory /home/www/cgi-bin/>
       Options ExecCGI
       AddHandler cgi-script cgi pl
   </Directory>

Problèmes rencontrés

Avec un mauvais fichier (absent ou URI erronée)
script not found or unable to stat: /var/www/monuser/cgi-bin/hello.pl
Avec la bonne URI
==> /var/log/apache2/suexec.log <==
uid: (10021/monuser) gid: (100/users) cmd: hello.pl
target uid/gid (10021/100) mismatch with directory (10021/100) or program (0/0)
==> /var/log/apache2/www.monuser.biz-error.log <==
suexec policy violation: see suexec log for more details
Premature end of script headers: hello.pl
Avec le bon user (own)
==> /var/log/apache2/suexec.log <==
uid: (10021/monuser) gid: (100/users) cmd: hello.pl
file has no execute permission: (/var/www/monuser/cgi-bin/hello.pl)
==> /var/log/apache2/www.monuser.biz-error.log <==
suexec policy violation: see suexec log for more details
Premature end of script headers: hello.pl
Que manque t'il ici ?....
==> /var/log/apache2/suexec.log <==
uid: (10021/monuser) gid: (100/users) cmd: hello.pl
(2)No such file or directory: exec failed (hello.pl)
==> /var/log/apache2/www.monuser.biz-error.log <==
suexec policy violation: see suexec log for more details
Premature end of script headers: hello.pl

Les corrections d'erreurs

Mauvais chemin pour le binaire perl

Par exemple #!/usr/local/bin/perl à la place de #!/usr/bin/perl

Truc indéterminé

Nécessite l'ajout de l'option -w dans l'entête du script perl (#!/usr/bin/perl -w)

Les autres en parlent

De faire attention aux retours chariots windows/linux qui peuvent faire planter le script ^M

Ressources