Install, Setup and Configure CGI and Perl in Windows XP Installer, installer et configurer CGI et Perl sous Windows XP
Prerequisite Pré-requis
Obvioulsy, a web server needs to be running on the Windows machine. Obvioulsy, un serveur Web doit être en cours d'exécution sur la machine Windows. Refer to this Reportez-vous à cette post poste for instructions on how to install Apache2 in Windows. pour obtenir des instructions sur la façon d'installer Apache2 dans Windows.
Download ActivePerl Télécharger ActivePerl
Download ActivePerl from Téléchargement de ActivePerl http://www.activestate.com/Products/ActivePerl/?mp=1 . Click on Free Download to start the download process. Cliquez sur Téléchargement gratuit pour démarrer le processus de téléchargement. There is no need to input any contact info. Il n'est pas nécessaire de saisir une coordonnées. Just leave it blank and press ‘Next’ to start the download. Il suffit de laisser ce champ vide et appuyez sur "Suivant" pour commencer le téléchargement.
Then download the lastest version of Windows MSI package. Alors téléchargez la dernière version de Windows package MSI.
Install ActivePerl Installez ActivePerl
Start the installation by double clicking the setup file. Démarrez l'installation en double cliquant sur le fichier d'installation. Follows the on-screen instruction. Suit à l'écran l'instruction. If you will be using Perl CGI programs and want to maintain some level of portability between both Linux machines and Windows machines, you may want to install Perl at the same location on your Windows machine as it is on most Linux machines. Si vous comptez utiliser des programmes CGI en Perl et que vous voulez maintenir un certain niveau de portabilité entre les deux machines Linux et Windows machines, mai vous voulez installer Perl au même endroit sur votre machine Windows comme elle l'est sur la plupart des machines Linux.
For example, on Linux machine, Perl is located at /usr/bin/perl and so every Perl program that I write begins with #!/usr/bin/perl . Par exemple, le système d'exploitation Linux, Perl se trouve dans / usr / bin / perl et Perl afin que chaque programme que je commence par écrire #! / Usr / bin / perl. So, it’s best when install Perl on an Windows machine, instead of installing it in the default location (ie C:\perl), install it in C:\usr instead, so that the Perl executable is located at /usr/bin/perl. Donc, il vaut mieux lorsqu'ils installent Perl sur une machine Windows, au lieu de l'installer dans l'emplacement par défaut (c'est-à-dire C: \ perl), installez-le dans C: \ usr lieu, de sorte que Perl exécutable se trouve dans / usr / bin / perl. This allows codes written on Windows machine been moved to, without changes, to Linux machine, and have it run there, and vice versa. Cela permet à des codes écrits sur machine Windows à été déplacé, sans modification, à machine Linux, et de la faire exécuter, et vice versa.
To change the installation path, click on browse button when you’re on the installation screen that prompts you to select which features you want to install. Pour changer le chemin d'installation, cliquez sur le bouton de recherche lorsque vous êtes sur l'écran d'installation qui vous invite à sélectionner les fonctionnalités que vous voulez installer. Set it to C:\usr\ if needed. Réglez-le dans C: \ usr \ si nécessaire.
Make sure that the following options is checked (selected): Assurez-vous que l'une des options suivantes est cochée (sélection):
Add Perl to the PATH environment variable Ajouter Perl pour la variable d'environnement PATH
Create Perl file extension association Créer Perl extension de fichier d'association
Activating CGI Activation de CGI
Open the httpd.conf file for editing by selecting Start > Programs > Apache HTTP Server > Configure Apache Server > Edit the Apache httpd.conf Configuration File. Ouvrez le fichier httpd.conf pour l'édition en sélectionnant Démarrer> Programmes> Apache HTTP Server> Configurer Apache Server> Modifier Apache fichier de configuration httpd.conf. Alternatively, open the httpd.conf with any text editor. Sinon, ouvrez le fichier httpd.conf avec un éditeur de texte.
In the main directory section, search for Options Indexes FollowSymLinks (at about line 267), and add ExecCGI to the end so it looks like: Dans le répertoire principal section, recherchez Options Indexes FollowSymLinks (à près de la ligne 267), et ajouter ExecCGI à la fin il se présente comme suit:
Options Indexes FollowSymLinks ExecCGI Options Indexes FollowSymLinks ExecCGI
Search for the following line and remove the hash mark character (#) to uncomment this line. Recherche de la ligne suivante et supprimer le caractère dièse (#) pour décommenter cette ligne. (You can also change .cgi to .pl, or add .pl behind .cgi if you prefer that perl extention is also treated as cgi files) For example: (Vous pouvez également changer. Cgi. Pl, ou ajouter. Pl derrière. Cgi si vous préférez que perl extension est aussi traitée comme fichiers CGI) Par exemple:
#AddHandler cgi-script .cgi # AddHandler cgi-script. Cgi
Should look like: Devrait ressembler à:
AddHandler cgi-script .cgi .pl AddHandler cgi-script. Cgi. Pl
or ou
AddHandler cgi-script .pl AddHandler cgi-script. Pl
or ou
AddHandler cgi-script .cgi AddHandler cgi-script. Cgi
Save the httpd.conf configuration file, restart the Apache server. Enregistrez le fichier de configuration httpd.conf, redémarrez le serveur Apache. Test the configuration as described in Testing Your Web Server CGI Configuration at the end of this article. Pour tester la configuration comme décrit dans les essais de votre serveur Web CGI de configuration à la fin de cet article.
Optional: Enabling CGI in Any Directory Facultatif: L'activation de CGI dans n'importe quel répertoire
If you want to use CGI outside ScriptAliased directory (ScriptAlias is usually the Apache2/cgi-bin/), comment out the following line: Si vous souhaitez utiliser en dehors de CGI ScriptAliased répertoire (ScriptAlias est généralement le Apache2/cgi-bin /), commentez la ligne suivante:
ScriptAlias /cgi-bin/ “C:/Program Files/Apache Group/Apache2/cgi-bin/” ScriptAlias / cgi-bin / "C: / Program Files / Apache Group/Apache2/cgi-bin /"
Should look like: Devrait ressembler à:
#ScriptAlias /cgi-bin/ “C:/Program Files/Apache Group/Apache2/cgi-bin/” # ScriptAlias / cgi-bin / "C: / Program Files / Apache Group/Apache2/cgi-bin /"
Alternatively, if you want to specify just one directory to put all your cgi programs, change the path instead, but makes ure that directory exists. Par ailleurs, si vous voulez spécifier un seul répertoire à mettre tous vos programmes CGI, changer le chemin d'accès au lieu, mais fait ure ce répertoire existe.
Should look like (for default settings): Devrait ressembler (pour les réglages par défaut):
ScriptAlias /cgi-bin/ “your_prefer_cgi-bin_direcotry” ScriptAlias / cgi-bin / "your_prefer_cgi-bin_direcotry"
Save the httpd.conf file. Enregistrez le fichier httpd.conf. Restart the Apache server. Redémarrez le serveur Apache.
Finding Perl Executable Location Trouver l'emplacement exécutable perl
If you don’t know where is perl.exe installed to, go to Start -> Search and search for perl.exe. Si vous ne savez pas où est installé à perl.exe, allez dans Démarrer -> Recherche et de recherche pour perl.exe. This location is the path to the perl executable that has to be put on the top of all cgi scripts. Cet emplacement est le chemin vers l'exécutable perl qui doit être mis sur la partie supérieure de tous les scripts cgi. If you follow default installation procedure, the path should be C:/perl/bin/perl.exe Si vous suivez la procédure d'installation par défaut, le chemin doit être C: / perl / bin / perl.exe
For the path to perl.exe path, all of these format are valid: Par la voie de chemin perl.exe, tous ces format sont valables:
#!c:/perl/bin/perl.exe #! c: / perl / bin / perl.exe
#!c:/perl/bin/perl #! c: / perl / bin / perl
#!/perl/bin/perl.exe #! / perl / bin / perl.exe
#!/perl/bin/perl #! / perl / bin / perl
Testing Your Web Server CGI Configuration Test de votre serveur Web CGI de configuration
Save the following test script in your DocumentRoot directory (if you have uncomment ScriptAlias, you can put it anywhere inside your DocumentRoot directory, or if you have set ScriptAlias to some particular directory, put the cgi in that directory only, ie Apache2/cgi-bin) as test.pl or test.cgi (depending on your configuration of the AddHandler line) and modify the first line as required to point to your ActivePerl interpreter: Enregistrez le script de test suivants dans votre répertoire DocumentRoot (si vous avez décommenter ScriptAlias, vous pouvez placer n'importe où dans votre répertoire DocumentRoot, ou si vous avez défini ScriptAlias à certains répertoire, mettez le cgi dans ce répertoire seulement, c'est-à-dire Apache2/cgi- bin) ou test.cgi test.pl (en fonction de votre configuration de la ligne AddHandler) et de modifier la première ligne au besoin pour pointer sur votre ActivePerl interprète:
#!c:\perl\bin\perl.exe #! c: \ perl \ bin \ perl.exe
# ^^^ this must be the first line of the script! # ^ ^ ^ Ce doit être la première ligne du script! ^^^ ^ ^ ^
# start code # Code de début
use strict; use strict;
use CGI; use CGI;
my $q = new CGI; my $ q = new CGI;
# print header and start the markup output # Tête d'impression et de commencer la production de marquage
print $q->header( “text/html” ),$q->start_html( “hello from perl cgi!” ); print $ q-> header ( "text / html"), $ q-> start_html ( "bonjour de CGI en Perl!");
print $q->h2(”hello dave…”); print $ q-> h2 ( "bonjour dave…");
print $q->end_html; print $ q-> end_html;
# end code # Fin du code
Now go to Maintenant, allez dans http://localhost/cgi-bin/test.cgi (scripts in Apache2/cgi-bin/ are read as http://localhost/cgi-bin/ by default). (scripts dans Apache2/cgi-bin / sont lus comme http://localhost/cgi-bin/ par défaut). You should see a page that displays a level two heading with the following text: Vous devriez voir une page qui affiche un niveau deux positions avec le texte suivant:
hello dave Bonjour Dave
If you see the above message, CGI is running. Si vous voyez le message ci-dessus, CGI est en cours d'exécution. If you get a 500 error, go to the last entry in your Apache2/logs/error.log (or the Review Error Log in the Start menu) to see exactly what caused this error. Si vous obtenez une erreur 500, allez à la dernière entrée dans votre Apache2/logs/error.log (ou l'examen log d'erreurs dans le menu Démarrer) pour voir exactement ce qui a causé cette erreur.
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANT: Il s'agit d'une machine qui traduit la page est fourni «tel quel», sans garantie. Machine translation may be difficult to understand. La traduction automatique mai être difficile à comprendre. Please refer to S’il vous plaît se référer à original English article l'article original en anglais whenever possible. chaque fois que possible.
Share and contribute or get technical support and help at Partagez et contribuer ou obtenir de l'aide technique et l'aide à My Digital Life Forums Ma vie numérique forums .
Related Articles Articles connexes
- Install AWStats- Free Logfile Analyzer for Site Statistics Installer AWStats-analyseur de logs Gratuit pour les statistiques du site
- Easily Set Up Web Server with XAMPP Mettre en place facilement serveur Web avec XAMPP
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4 L'installation de Web Server sous Windows XP avec Apache2, MySQL4 et PHP5 - Partie 4
- CPAN Missing Parameter auto_commit Message CPAN paramètre manquant auto_commit message
- Internal Error 2739 Error in Vista (32 or 64-bit) When Install Adobe Photoshop CS3 and Reflector Related Programs Erreur interne 2739 Erreur dans Vista (32 ou 64 bits) Lors de l'installation d'Adobe Photoshop CS3 et des programmes liés à Réflecteur
- Enable and Display Security Tab in Windows XP Home Edition Activer et affichage onglet Sécurité sous Windows XP Home Edition
- eMule 0.48a for Windows Vista Free Download eMule 0.48a pour Windows Vista Téléchargement gratuit
- Hack and Workaround to Clean or Fresh Install Windows Vista with Upgrade License DVD Hack et Palliatif à nettoyer ou nouvelle installation de Windows Vista avec licence de mise à niveau DVD
- Trick to Install Windows XP SP3 RC in Non-English Language Editions Astuce pour installer Windows XP SP3 RC non-Anglais Langue éditions
- Download Yahoo! Télécharger Yahoo! Messenger with Voice 8 Full Standalone Installer Messenger 8 pleine d'installation autonome









January 2nd, 2006 02:19 Janvier 2 septembre 2006 02h19
[...] As AWStats is Perl based, a Perl Interpreter need to be installed first to take anvantage of AWStats. [...] Comme AWStats est basée Perl, Perl un interprète doivent être installés premier à prendre anvantage de AWStats. For instruction on how to install Perl in Windows machine, check out this article. Pour des instructions sur comment installer Perl machine sous Windows, consultez cet article. [...]
July 25th, 2006 20:53 Juillet 25th, 2006 20:53
I have installed cgi and configured apache as you said, but i got this erro: J'ai installé et configuré cgi apache comme vous l'avez dit, mais j'ai eu cette erreur:
Internal Server Error Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request. Le serveur a rencontré une erreur interne ou une mauvaise et n'a pas été en mesure de traiter votre demande.
Please contact the server administrator, webmaster@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. S’il vous plaît contactez l'administrateur du serveur, webmaster @ localhost et les informer du moment où l'erreur s'est produite, et tout ce que vous pourriez avoir fait mai ont causé l'erreur.
More information about this error may be available in the server error log. Plus d'informations sur cette erreur mai sont disponibles sur le serveur de log d'erreurs.
——————————————————————————– ---------------------------
Apache/2.0.58 (Win32) PHP/5.1.4 Server at localhost Port 80 Apache/2.0.58 (Win32) PHP/5.1.4 Server at localhost Port 80
May 10th, 2007 19:25 Mai 10th, 2007 19:25
Cool4you,guys. Cool4you, les gars.
June 20th, 2007 08:09 Juin 20th, 2007 08:09
Just for the record, the above test script throws a 500 error when used as is. Juste pour mémoire, le script de test ci-dessus lance une erreur 500 lorsque utilisé tel quel. Maybe it is just a problem with firefox displaying text or something, but the quotation marks are mixed up, so that could lead to problems Peut-être que c'est juste un problème avec firefox l'affichage du texte ou quelque chose, mais les guillemets sont mélangés, de manière à ce que pourrait donner lieu à des problèmes
October 8th, 2007 23:05 Octobre 8, 2007 23:05
Hi all, Salut tous,
I really need some help on this subject =) J'ai vraiment besoin d'aide sur ce sujet =)
I have followed the steps above, and changed the quotation marks, and what I get is 9 error messages: J'ai suivi les étapes ci-dessus, et a modifié les guillemets, et ce que je reçois est de 9 messages d'erreur:
Backslash found where operator expected at Z.\test.cgi line 1, near “rtf1\” Backslash là où l'opérateur devrait à Z. \ test.cgi ligne 1, près de "rtf1 \"
or …. ou…. , near “ansi\” , Près de "ansi \"
or …. ou…. , near “deff0″ , Près de "deff0"
or …. ou…. , near “f1\” , Près de "f1 \"
etc.. etc.
I am a total rookie with these things, any help appreciated =) Je suis un débutant total avec ces choses, toute aide est appréciée =)
Thanks, Merci,
Johanna
November 28th, 2007 22:14 Novembre 28th, 2007 22:14
I did everything you said. Je ne vous dit tout. But cgi is still not running. Cgi, mais n'est pas encore en cours d'exécution. Please help. S’il vous plaît aider.
my apache is 2.2 mon Apache est de 2,2