Install, Setup and Configure CGI and Perl in Windows XP Installare, installazione e configurazione CGI e Perl in Windows XP
Prerequisite Prerequisito
Obvioulsy, a web server needs to be running on the Windows machine. Obvioulsy, un server web deve essere in esecuzione sulla macchina Windows. Refer to this Riferimento a questo post for instructions on how to install Apache2 in Windows. per le istruzioni su come installare Apache2 in Windows.
Download ActivePerl Download ActivePerl
Download ActivePerl from ActivePerl da scaricare http://www.activestate.com/Products/ActivePerl/?mp=1 . Click on Free Download to start the download process. Fare clic su Download gratuito per avviare il processo di download. There is no need to input any contact info. Non vi è alcuna necessità di inserire qualsiasi informazioni di contatto. Just leave it blank and press ‘Next’ to start the download. Solo lasciarla vuota e premere 'Avanti' per avviare il download.
Then download the lastest version of Windows MSI package. Quindi scaricare l'ultima versione di Windows pacchetto MSI.
Install ActivePerl Installare ActivePerl
Start the installation by double clicking the setup file. Avviare l'installazione facendo doppio clic sul file di installazione. Follows the on-screen instruction. Segue le istruzioni a schermo. 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. Se utilizzerai programmi Perl CGI e vogliono mantenere un certo livello di portabilità tra le due macchine Linux e Windows macchine, è possibile che si desideri installare Perl nella stessa posizione sul tuo computer Windows in quanto è sulla maggior parte delle macchine 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 . Per esempio, sulla macchina Linux, Perl si trova in / usr / bin / perl e così ogni programma Perl che scrivo inizia con #! / 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. Quindi, è meglio quando installare Perl su una macchina Windows, invece di installarlo nella posizione di default (ad esempio C: \ perl), installarlo in C: \ usr invece, in modo che il Perl eseguibile si trova in / 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. Questo permette codici scritti a macchina Windows stato spostato, senza modifiche, a macchina Linux, e farlo funzionare, e viceversa.
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. Per modificare il percorso di installazione, fare clic sul pulsante Sfoglia quando sei sulla schermata di installazione che richiede di selezionare le caratteristiche che si desidera installare. Set it to C:\usr\ if needed. Impostarlo su C: \ usr \ se necessario.
Make sure that the following options is checked (selected): Assicurarsi che le seguenti opzioni è selezionata (selezione):
Add Perl to the PATH environment variable Aggiungi il Perl variabile di ambiente PATH
Create Perl file extension association Perl creare file con estensione associazione
Activating CGI Attivazione 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. Aprire il file httpd.conf per la modifica selezionando Start> Programmi> Apache HTTP Server> Configura server Apache> Modifica Apache httpd.conf file di configurazione. Alternatively, open the httpd.conf with any text editor. In alternativa, aprire il httpd.conf con qualsiasi editor di testo.
In the main directory section, search for Options Indexes FollowSymLinks (at about line 267), and add ExecCGI to the end so it looks like: Nella directory principale sezione Opzioni di ricerca per FollowSymLinks Indexes (linea a circa 267) e aggiungere ExecCGI alla fine in modo che appare come segue:
Options Indexes FollowSymLinks ExecCGI Opzioni indici ExecCGI FollowSymLinks
Search for the following line and remove the hash mark character (#) to uncomment this line. Cerca la seguente riga e rimuovere il carattere carattere (#) per togliere il commento a questa linea. (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: (Potete anche cambiare. Cgi. Pl, o aggiungere. Pl dietro. Cgi se si preferisce che perl estensione è anche trattata come file CGI) Ad esempio:
#AddHandler cgi-script .cgi # AddHandler cgi-script. Cgi
Should look like: Dovrebbe essere simile:
AddHandler cgi-script .cgi .pl AddHandler cgi-script. Cgi. Pl
or o
AddHandler cgi-script .pl AddHandler cgi-script. Pl
or o
AddHandler cgi-script .cgi AddHandler cgi-script. Cgi
Save the httpd.conf configuration file, restart the Apache server. Salvare il file di configurazione httpd.conf, riavviare il server Apache. Test the configuration as described in Testing Your Web Server CGI Configuration at the end of this article. La configurazione di prova, come descritto in fase di test il server Web CGI di configurazione, alla fine di questo articolo.
Optional: Enabling CGI in Any Directory Opzionale: L'attivazione di CGI in qualsiasi cartella
If you want to use CGI outside ScriptAliased directory (ScriptAlias is usually the Apache2/cgi-bin/), comment out the following line: Se si desidera utilizzare CGI al di fuori ScriptAliased directory (ScriptAlias è di solito il Apache2/cgi-bin /), commentare la riga seguente:
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: Dovrebbe essere simile:
#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. In alternativa, se si desidera specificare una sola directory per mettere tutti i vostri programmi cgi, modificare il percorso, invece, ma rende ure quella directory esiste.
Should look like (for default settings): Dovrebbe essere simile (per default):
ScriptAlias /cgi-bin/ “your_prefer_cgi-bin_direcotry” ScriptAlias / cgi-bin / "your_prefer_cgi-bin_direcotry"
Save the httpd.conf file. Salvare il file httpd.conf. Restart the Apache server. Riavviare il server Apache.
Finding Perl Executable Location Trovare perl eseguibile Ubicazione
If you don’t know where is perl.exe installed to, go to Start -> Search and search for perl.exe. Se non sai dove è installato a perl.exe, vai su Start -> Cerca e ricerca di perl.exe. This location is the path to the perl executable that has to be put on the top of all cgi scripts. Questo percorso è il percorso del perl eseguibile che deve essere messo in cima a tutti i script CGI. If you follow default installation procedure, the path should be C:/perl/bin/perl.exe Se si segue procedura di installazione di default, il percorso deve essere C: / perl / bin / perl.exe
For the path to perl.exe path, all of these format are valid: Per il percorso perl.exe percorso, tutti questi sono validi formato:
#!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 il vostro web server CGI di configurazione
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: Salva la prova seguente script nella vostra directory DocumentRoot (se si dispone di togliere il ScriptAlias, va inserito ovunque all'interno della vostra directory DocumentRoot, o se avete impostato ScriptAlias ad alcune directory particolare, mettere il cgi in quella directory solo, vale a dire Apache2/cgi- bin) o come test.pl test.cgi (a seconda della propria configurazione di AddHandler la linea) e modificare la prima linea, come previsto al punto a vostro interprete ActivePerl:
#!c:\perl\bin\perl.exe #! c: \ perl \ bin \ perl.exe
# ^^^ this must be the first line of the script! # ^ ^ ^ Questa deve essere la prima linea dello script! ^^^ ^ ^ ^
# start code # Inizio codice
use strict; use strict;
use CGI; utilizzare CGI;
my $q = new CGI; my $ q = new CGI;
# print header and start the markup output # Stampa intestazione e iniziare la produzione di marcatura
print $q->header( “text/html” ),$q->start_html( “hello from perl cgi!” ); print $ q-> header ( "text / html"), $ q-> start_html ( "ciao da perl cgi!");
print $q->h2(”hello dave…”); print $ q-> H2 ( "ciao dave…");
print $q->end_html; print $ q-> end_html;
# end code # Fine codice
Now go to Adesso vai a http://localhost/cgi-bin/test.cgi (scripts in Apache2/cgi-bin/ are read as http://localhost/cgi-bin/ by default). (script in Apache2/cgi-bin / vengono lette come http://localhost/cgi-bin/ per impostazione predefinita). You should see a page that displays a level two heading with the following text: Si dovrebbe vedere una pagina che visualizza un livello due voce con il testo seguente:
hello dave Ciao Dave
If you see the above message, CGI is running. Se viene visualizzato il messaggio di cui sopra, CGI è in esecuzione. 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. Se si ottiene un errore 500, vai a questo ultimo ingresso nella vostra Apache2/logs/error.log (o la modifica di errore Entra nel menu Start) per vedere esattamente che cosa ha provocato questo errore.
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANTE: Questa è una pagina tradotta macchina che è fornito "così com'è" senza alcuna garanzia. Machine translation may be difficult to understand. Traduzione automatica può essere difficile da capire. Please refer to Si prega di fare riferimento a original English article articolo originale inglese whenever possible. quando possibile.
Share and contribute or get technical support and help at Condividere e contribuire o ottenere supporto tecnico e assistenza in My Digital Life Forums La mia vita digitale Forum .
Related Articles Articoli correlati
- Install AWStats- Free Logfile Analyzer for Site Statistics Installare awstats-free analizzatore di file di log per le statistiche del sito
- Easily Set Up Web Server with XAMPP Facilmente istituire server Web con XAMPP
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4 Installare server Web in Windows XP con Apache2, PHP5 e MySQL4 - Parte 4
- CPAN Missing Parameter auto_commit Message CPAN parametro mancante auto_commit messaggio
- Internal Error 2739 Error in Vista (32 or 64-bit) When Install Adobe Photoshop CS3 and Reflector Related Programs Errore interno 2739 Errore in Vista (32 o 64 bit) Quando Installare Adobe Photoshop CS3 e Reflector Programmi correlati
- Enable and Display Security Tab in Windows XP Home Edition Abilitazione e visualizzazione scheda di sicurezza in Windows XP Home Edition
- eMule 0.48a for Windows Vista Free Download eMule 0.48a per Windows Vista Free Download
- Hack and Workaround to Clean or Fresh Install Windows Vista with Upgrade License DVD Hack e workaround per pulire o nuova installazione di Windows Vista con licenza di aggiornamento DVD
- Trick to Install Windows XP SP3 RC in Non-English Language Editions Trucco per installare Windows XP SP3 rc non-english edizioni linguistiche
- Download Yahoo! Download Yahoo! Messenger with Voice 8 Full Standalone Installer Messenger 8 pieno Standalone Installer

































January 2nd, 2006 02:19 2 gennaio 2006 02:19
[...] As AWStats is Perl based, a Perl Interpreter need to be installed first to take anvantage of AWStats. [...] Come AWStats è basato su Perl, un interprete Perl deve essere installato prima di prendere anvantage di AWStats. For instruction on how to install Perl in Windows machine, check out this article. Per istruzioni su come installare Perl in macchina Windows, leggi questo articolo. [...]
July 25th, 2006 20:53 25 luglio 2006 20:53
I have installed cgi and configured apache as you said, but i got this erro: Ho installato e configurato cgi apache come lei ha detto, ma ho ottenuto questo errore:
Internal Server Error Errore interno del server
The server encountered an internal error or misconfiguration and was unable to complete your request. Il server ha incontrato un errore interno o di una errata e non è riuscito a completare la richiesta.
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. Si prega di contattare l'amministratore del server, webmaster @ localhost e comunicare loro il tempo si è verificato l'errore, e tutto ciò che si potrebbe avere fatto che possono avere causato l'errore.
More information about this error may be available in the server error log. Maggiori informazioni su questo errore può essere disponibile nel registro di errore del server.
——————————————————————————– ---------------------------
Apache/2.0.58 (Win32) PHP/5.1.4 Server at localhost Port 80 Apache/2.0.58 (Win32) PHP/5.1.4 Server a localhost Port 80
May 10th, 2007 19:25 May 10th, 2007 19:25
Cool4you,guys. Cool4you, ragazzi.
June 20th, 2007 08:09 20 giugno 2007 08:09
Just for the record, the above test script throws a 500 error when used as is. Solo per la cronaca, la prova di cui sopra getta uno script di errore 500 quando viene utilizzato come è. 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 Forse si tratta solo di un problema con Firefox la visualizzazione di testo o qualcosa, ma i segni di citazione vengono confusi, in modo tale che potrebbe portare a problemi
October 8th, 2007 23:05 8 ottobre 2007 23:05
Hi all, Ciao a tutti,
I really need some help on this subject =) Io ho bisogno di aiuto su questo argomento =)
I have followed the steps above, and changed the quotation marks, and what I get is 9 error messages: Ho seguito la procedura di cui sopra, e cambiato le virgolette, e quello che ricevo è di 9 messaggi di errore:
Backslash found where operator expected at Z.\test.cgi line 1, near “rtf1\” Backslash trovato dove operatore attesi per Z. \ test.cgi linea 1, vicino "rtf1 \"
or …. o…. , near “ansi\” , Vicino a "ansi \"
or …. o…. , near “deff0″ , Vicino a "deff0"
or …. o…. , near “f1\” , Vicino a "f1 \"
etc.. ecc.
I am a total rookie with these things, any help appreciated =) Io sono un totale rookie con queste cose, di tutto l'aiuto apprezzato =)
Thanks, Grazie,
Johanna
November 28th, 2007 22:14 28 novembre 2007 22:14
I did everything you said. Ho fatto tutto ciò che ha detto. But cgi is still not running. Cgi, ma non è ancora in esecuzione. Please help. Please help.
my apache is 2.2 Apache è il mio 2,2