Install, Setup and Configure CGI and Perl in Windows XP Instalar, instalação e configuração CGI e Perl no Windows XP
Prerequisite Pré-requisito
Obvioulsy, a web server needs to be running on the Windows machine. Obvioulsy, um servidor web precisa ser correr na máquina Windows. Refer to this Remeter para o presente post for instructions on how to install Apache2 in Windows. para instruções sobre como instalar Apache2 no Windows.
Download ActivePerl Download ActivePerl
Download ActivePerl from Download de ActivePerl http://www.activestate.com/Products/ActivePerl/?mp=1 . Click on Free Download to start the download process. Clique em Download gratuito para iniciar o processo de download. There is no need to input any contact info. Não há necessidade de introduzir quaisquer informações de contato. Just leave it blank and press ‘Next’ to start the download. Apenas deixe em branco e pressione "Next" para iniciar o download.
Then download the lastest version of Windows MSI package. Em seguida, fazer o download da versão mais recente do Windows pacote MSI.
Install ActivePerl Instale ActivePerl
Start the installation by double clicking the setup file. Inicie a instalação clicando duas vezes arquivo de configuração. Follows the on-screen instruction. Segue as instruções na tela. 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 for utilizar Perl CGI programas e querem manter um certo nível de portabilidade entre ambas as máquinas Linux e Windows máquinas, você pode querer instalar o Perl no mesmo local em sua máquina Windows, pois é na maioria das máquinas 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 . Por exemplo, a máquina Linux, Perl está localizado em / usr / bin / perl Perl e assim por cada programa que eu escrevo começa com #! / 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. Portanto, é melhor quando instalar o Perl em uma máquina Windows, em vez de instalá-la no local padrão (ou seja C: \ perl), instalá-lo em C: \ usr vez, de modo a que o Perl executável está localizado em / 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. Isto permite que códigos escritos na máquina sido transferido para o Windows, sem alterações, a máquina Linux, e têm que correr lá, e 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. Para alterar o caminho de instalação, clique no botão Procurar quando estiver na tela de instalação pede-lhe para seleccionar quais as funcionalidades que pretende instalar. Set it to C:\usr\ if needed. Configure-a para C: \ usr \ se for necessário.
Make sure that the following options is checked (selected): Certifique-se que as seguintes opções é controlada (seleccionadas):
Add Perl to the PATH environment variable Adicionar Perl para a variável de ambiente PATH
Create Perl file extension association Criar Perl extensão Associação
Activating CGI Activar 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. Abra o arquivo httpd.conf para a edição, selecionando Iniciar> Programas> Apache HTTP Server> Configurar Servidor Apache> Edite o arquivo de configuração httpd.conf Apache. Alternatively, open the httpd.conf with any text editor. Alternativamente, abra o httpd.conf em qualquer editor de texto.
In the main directory section, search for Options Indexes FollowSymLinks (at about line 267), and add ExecCGI to the end so it looks like: No diretório principal seção, busca de opções Indexes FollowSymLinks (em linha cerca de 267), e adicione ExecCGI para o fim para que ele se parece com:
Options Indexes FollowSymLinks ExecCGI Opções ExecCGI Indexes FollowSymLinks
Search for the following line and remove the hash mark character (#) to uncomment this line. Buscar a linha a seguir e remova a marca caracter hash (#) para descomentar esta linha. (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: (Você também pode mudar. Cgi para. Pl, ou acrescentar. Pl trás. Cgi se você preferir que a extensão perl também é tratada como cgi arquivos) Por exemplo:
#AddHandler cgi-script .cgi # AddHandler cgi-script. Cgi
Should look like: Deve ser semelhante a este:
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. Salve o arquivo de configuração httpd.conf, reinicie o servidor Apache. Test the configuration as described in Testing Your Web Server CGI Configuration at the end of this article. Teste a configuração tal como descrito no Teste o servidor web CGI configuração no final deste artigo.
Optional: Enabling CGI in Any Directory Opcional: Ativação CGI em qualquer directório
If you want to use CGI outside ScriptAliased directory (ScriptAlias is usually the Apache2/cgi-bin/), comment out the following line: Se você quiser usar CGI fora ScriptAliased diretório (ScriptAlias é normalmente o Apache2/cgi-bin /), comente as seguintes linhas:
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: Deve ser semelhante a este:
#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. Alternativamente, se você desejar apenas especificar um diretório para colocar todos os seus programas cgi, mudar o rumo vez, mas torna ure que o diretório existe.
Should look like (for default settings): Deve ser semelhante a este (para as configurações padrão):
ScriptAlias /cgi-bin/ “your_prefer_cgi-bin_direcotry” ScriptAlias / cgi-bin / "your_prefer_cgi-bin_direcotry"
Save the httpd.conf file. Salve o arquivo httpd.conf. Restart the Apache server. Reinicie o servidor Apache.
Finding Perl Executable Location Encontrar Perl executável local
If you don’t know where is perl.exe installed to, go to Start -> Search and search for perl.exe. Se você não sabe onde está instalada a perl.exe, vá para Iniciar -> Busca e pesquisa de perl.exe. This location is the path to the perl executable that has to be put on the top of all cgi scripts. Este local é o caminho para o executável perl que tem de ser colocado no topo de todos os scripts cgi. If you follow default installation procedure, the path should be C:/perl/bin/perl.exe Se você seguir procedimento instalação padrão, o caminho deve ser C: / perl / bin / perl.exe
For the path to perl.exe path, all of these format are valid: Para o caminho para perl.exe caminho, todos esses formatos são válidos:
#!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 Testando o servidor web configuração CGI
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: Salve o teste seguinte script em seu diretório DocumentRoot (se você tiver descomentar ScriptAlias, você pode colocá-lo em qualquer lugar dentro do seu diretório DocumentRoot, ou se você tiver definido ScriptAlias a alguns diretórios específica, coloque o diretório cgi, em que apenas, ou seja, Apache2/cgi- bin) ou como test.pl test.cgi (dependendo de sua configuração do AddHandler linha) e alterar a primeira linha como exige a apontar para o ActivePerl intérprete:
#!c:\perl\bin\perl.exe #! c: \ perl \ bin \ perl.exe
# ^^^ this must be the first line of the script! # ^ ^ ^ Essa deve ser a primeira linha do script! ^^^ ^ ^ ^
# start code # Começar código
use strict; uso rigoroso;
use CGI; use CGI;
my $q = new CGI; my $ q = new CGI;
# print header and start the markup output # Imprimir cabeçalho e iniciar a marcação de saída
print $q->header( “text/html” ),$q->start_html( “hello from perl cgi!” ); print $ q-> header ( "text / html"), US $ q-> start_html ( "hello de perl cgi!");
print $q->h2(”hello dave…”); print $ q-> h2 ( "hello dave…");
print $q->end_html; print $ q-> end_html;
# end code # Final código
Now go to Agora vá para http://localhost/cgi-bin/test.cgi (scripts in Apache2/cgi-bin/ are read as http://localhost/cgi-bin/ by default). (scripts em Apache2/cgi-bin / são entendidas como http://localhost/cgi-bin/ por padrão). You should see a page that displays a level two heading with the following text: Você deverá ver uma página que apresente um nível duas posições com o seguinte texto:
hello dave Olá Dave
If you see the above message, CGI is running. Se você ver a mensagem acima, CGI está executando. 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 você receber um erro 500, vá para a última entrada no seu Apache2/logs/error.log (ou registro de Revisão Erro no menu Iniciar) para ver exatamente o que causou este erro.
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANTE: Esta é uma página traduzida máquina que é fornecida "como está" sem garantia. Machine translation may be difficult to understand. A tradução automática pode ser difícil de compreender. Please refer to Por favor, consulte a original English article Inglês original article whenever possible. sempre que possível.
Share and contribute or get technical support and help at Compartilhe e contribuir ou obter suporte técnico e ajudar a My Digital Life Forums Minha vida digital Fóruns .
Related Articles Artigos relacionados
- Install AWStats- Free Logfile Analyzer for Site Statistics Instale AWStats-Free logfile analisador para as estatísticas do site
- Easily Set Up Web Server with XAMPP Facilmente criado com o servidor web XAMPP
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4 Instalar Web Server no Windows XP com Apache2, PHP5 e MySQL4 - Parte 4
- CPAN Missing Parameter auto_commit Message CPAN faltando parâmetro auto_commit mensagem
- Internal Error 2739 Error in Vista (32 or 64-bit) When Install Adobe Photoshop CS3 and Reflector Related Programs Erro interno Erro em 2739 Vista (32 ou 64 bits) Quando Instalar Adobe Photoshop CS3 e Refletor Programas relacionados
- Enable and Display Security Tab in Windows XP Home Edition Habilitar e exibir guia Segurança no Windows XP Home Edition
- eMule 0.48a for Windows Vista Free Download eMule 0.48a Windows Vista para download gratuito
- Hack and Workaround to Clean or Fresh Install Windows Vista with Upgrade License DVD Hack e de forma limpa e fresca para instalar a atualização do Windows Vista licença DVD
- Trick to Install Windows XP SP3 RC in Non-English Language Editions Truque para instalar o Windows XP SP3 RC em língua não-Inglês Edições
- Download Yahoo! Download Yahoo! Messenger with Voice 8 Full Standalone Installer Messenger com voz 8 pleno autônomo instalador



















January 2nd, 2006 02:19 2 de janeiro de 2006 02:19
[...] As AWStats is Perl based, a Perl Interpreter need to be installed first to take anvantage of AWStats. Tal como [...] AWStats é baseado Perl, Perl Interpreter uma necessidade de ser instalado primeiro a ter anvantage de AWStats. For instruction on how to install Perl in Windows machine, check out this article. Para instruções sobre como instalar o Perl no Windows, verifique este artigo. [...]
July 25th, 2006 20:53 25 de julho de 2006 20:53
I have installed cgi and configured apache as you said, but i got this erro: Tenho instalado e configurado cgi apache como você disse, mas eu recebi este erro:
Internal Server Error Erro interno do servidor
The server encountered an internal error or misconfiguration and was unable to complete your request. O servidor encontrou um erro interno ou errada e não pôde concluir o seu pedido.
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. Entre em contato com o administrador do servidor, webmaster @ localhost e informá-los do tempo, o erro ocorreu, e você poderia ter feito alguma coisa que pode ter causado o erro.
More information about this error may be available in the server error log. Mais informações sobre esse erro pode estar disponível no servidor erro rápida.
——————————————————————————– ---------------------------
Apache/2.0.58 (Win32) PHP/5.1.4 Server at localhost Port 80 Apache/2.0.58 (Win32) PHP/5.1.4 Server em localhost Port 80
May 10th, 2007 19:25 10 de maio de 2007 19:25
Cool4you,guys. Cool4you, rapazes.
June 20th, 2007 08:09 20 de junho de 2007 08:09
Just for the record, the above test script throws a 500 error when used as is. Apenas para o registro, o teste acima script lança um erro 500 quando usado como está. 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 Talvez se trata apenas de um problema com o Firefox exibir texto ou alguma coisa, mas as aspas são confundidos, de forma que possa conduzir a problemas
October 8th, 2007 23:05 Outubro 8o, 2007 23:05
Hi all, Oi todos,
I really need some help on this subject =) Eu realmente necessitar de alguma ajuda sobre este assunto =)
I have followed the steps above, and changed the quotation marks, and what I get is 9 error messages: Tenho seguido os passos acima, e mudaram as aspas, e aquilo que eu vejo é 9 mensagens de erro:
Backslash found where operator expected at Z.\test.cgi line 1, near “rtf1\” Backslash operador onde esperava encontrar em Z. \ test.cgi linha 1, perto de "rtf1 \"
or …. ou…. , near “ansi\” , Perto de "ansi \"
or …. ou…. , near “deff0″ , Perto de "deff0"
or …. ou…. , near “f1\” , Perto de "f1 \"
etc.. etc.
I am a total rookie with these things, any help appreciated =) Eu sou um novato total com essas coisas, qualquer ajuda apreciado =)
Thanks, Obrigado,
Johanna
November 28th, 2007 22:14 28 de novembro de 2007 22:14
I did everything you said. Eu fiz tudo o que você disse. But cgi is still not running. Cgi mas ainda não está funcionando. Please help. Por favor, ajuda.
my apache is 2.2 O Apache é o meu 2,2