Install, Setup and Configure CGI and Perl in Windows XP Установка, настройка и конфигурирование CGI и Perl в Windows XP
Prerequisite Предпосылка
Obvioulsy, a web server needs to be running on the Windows machine. Obvioulsy, веб-сервер должен быть запущена на Windows машине. Refer to this Обратитесь к этому post должность for instructions on how to install Apache2 in Windows. Инструкции по установке Apache2 в Windows.
Download ActivePerl Скачать ActivePerl
Download ActivePerl from Скачать с ActivePerl http://www.activestate.com/Products/ActivePerl/?mp=1 . Click on Free Download to start the download process. Щелкните на Free Download, чтобы начать загрузку. There is no need to input any contact info. Существует нет необходимости вводить каких-либо контактную информацию. Just leave it blank and press ‘Next’ to start the download. Просто оставьте ее пустой и нажать "Далее" для начала загрузки.
Then download the lastest version of Windows MSI package. Тогда скачать последнюю версию Windows пакет MSI.
Install ActivePerl Установить ActivePerl
Start the installation by double clicking the setup file. Пуск установки двойным щелчком файла установки. Follows the on-screen 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. Если вы будете использовать Perl CGI программ, и вы хотите поддерживать определенный уровень переносимости между двумя машинами Linux и Windows машинах, вы можете установить Perl на том же месте на вашей Windows машине, как это делается на большинстве 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 . Например, на Linux машине, Perl находится в / usr / бен / perl, и поэтому каждый Perl программа, которая Пишу начинается с #! / Usr / бен / 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. Так что, лучше, если установить Perl на Windows машине, вместо установки в местоположения по умолчанию (например, C: \ perl), установите ее в C: \ usr вместо того, чтобы Perl исполняемый файл находится в / usr / бен / perl. This allows codes written on Windows machine been moved to, without changes, to Linux machine, and have it run there, and vice versa. Это позволяет коды, написанные на Windows машине перемещен без изменений, для Linux машине, а затем запустить там, и наоборот.
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. Чтобы изменить путь установки, нажмите на кнопку просмотра, когда вы будете на установку экран, который предложит вам выбрать, какие функции вы хотите установить. Set it to C:\usr\ if needed. Установите его в C: \ usr \, если это необходимо.
Make sure that the following options is checked (selected): Убедитесь в том, что следующие варианты проверяется (выбранные):
Add Perl to the PATH environment variable Добавить к Perl переменная окружения PATH
Create Perl file extension association Создайте Perl расширение файла ассоциации
Activating CGI Активация 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. Откройте файл httpd.conf для редактирования, выбрав Пуск> Программы> Apache HTTP Server> Настройка сервера Apache> Изменить Apache httpd.conf файл конфигурации. Alternatively, open the httpd.conf with any text editor. С другой стороны, открыть httpd.conf с любой текстовый редактор.
In the main directory section, search for Options Indexes FollowSymLinks (at about line 267), and add ExecCGI to the end so it looks like: В основной раздел каталога, осуществлять поиск по индексам Опции FollowSymLinks (примерно строка 267) и добавить ExecCGI к концу этого он выглядит следующим образом:
Options Indexes FollowSymLinks ExecCGI Параметры индексов FollowSymLinks ExecCGI
Search for the following line and remove the hash mark character (#) to uncomment this line. Искать следующую строку и удалить символ знака хэша (#) надо раскомментировать эту строку. (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: (Вы также можете изменить. Cgi с. Pl, или добавить. Pl позади. Cgi, если вы предпочитаете, чтобы perl внутр.номер также рассматривать как cgi-файлов) Например:
#AddHandler cgi-script .cgi # AddHandler подобную сценарий. Cgi
Should look like: Должен выглядеть так:
AddHandler cgi-script .cgi .pl AddHandler подобную сценарий. Cgi. Pl
or или
AddHandler cgi-script .pl AddHandler подобную сценарий. Pl
or или
AddHandler cgi-script .cgi AddHandler подобную сценарий. Cgi
Save the httpd.conf configuration file, restart the Apache server. Сохраните файл конфигурации httpd.conf, перезапустить сервер Apache. Test the configuration as described in Testing Your Web Server CGI Configuration at the end of this article. Проверка конфигурации, как описано в тестировании веб-сервере CGI конфигурацию в конце этой статьи.
Optional: Enabling CGI in Any Directory Дополнительно: Включение CGI в любом каталоге
If you want to use CGI outside ScriptAliased directory (ScriptAlias is usually the Apache2/cgi-bin/), comment out the following line: Если вы хотите использовать CGI вне ScriptAliased каталог (ScriptAlias обычно Apache2/cgi-bin /), раскомментируйте следующую строку:
ScriptAlias /cgi-bin/ “C:/Program Files/Apache Group/Apache2/cgi-bin/” ScriptAlias / подобную бен / "C: / Program Files / Apache Group/Apache2/cgi-bin /"
Should look like: Должен выглядеть так:
#ScriptAlias /cgi-bin/ “C:/Program Files/Apache Group/Apache2/cgi-bin/” # ScriptAlias / подобную бен / "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. Или же, если вы хотите указать только один каталог, чтобы поставить все ваши cgi программы, изменять путь вместо этого, но делает ure этот каталог не существует.
Should look like (for default settings): Будет выглядеть следующим образом (по умолчанию):
ScriptAlias /cgi-bin/ “your_prefer_cgi-bin_direcotry” ScriptAlias / подобную бен / "your_prefer_cgi-bin_direcotry"
Save the httpd.conf file. Сохраните файл httpd.conf. Restart the Apache server. Перезапустите Apache сервера.
Finding Perl Executable Location Нахождение Perl исполняемый Расположение
If you don’t know where is perl.exe installed to, go to Start -> Search and search for perl.exe. Если вы не знаете, где находится perl.exe установлен для перейдите на Пуск -> Найти и ищу perl.exe. This location is the path to the perl executable that has to be put on the top of all cgi scripts. Это расположение путь к исполняемого perl, который должен быть поставлен на вершине все cgi скрипты. If you follow default installation procedure, the path should be C:/perl/bin/perl.exe Если после выполнения процедуры установки по умолчанию, путь должен быть C: / perl / бен / perl.exe
For the path to perl.exe path, all of these format are valid: Для путь к perl.exe путь, все эти формы являются действительными:
#!c:/perl/bin/perl.exe #! с: / perl / бен / perl.exe
#!c:/perl/bin/perl #! с: / perl / бен / perl
#!/perl/bin/perl.exe #! / perl / бен / perl.exe
#!/perl/bin/perl #! / perl / бен / perl
Testing Your Web Server CGI Configuration Тестирование вашего веб-сервера 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: Сохранить следующий тест скрипт в вашем DocumentRoot директорию (если у вас есть раскомментировать ScriptAlias, вы можете поместить ее в любом месте на территории вашей DocumentRoot каталога, или если у вас есть набор ScriptAlias к определенной директории, ставит cgi в этом каталоге, только, т.е. Apache2/cgi- бин), как test.pl test.cgi или (в зависимости от конфигурации AddHandler линия) и изменить первую строку как это требуется, чтобы она указывала на Ваш ActivePerl переводчика:
#!c:\perl\bin\perl.exe #! с: \ perl \ бин \ perl.exe
# ^^^ this must be the first line of the script! # ^ ^ ^ Это должно быть первой строке скрипта! ^^^ ^ ^ ^
# start code # Начало кода
use strict; использование строгой;
use CGI; использование CGI;
my $q = new CGI; моя $ q = новый CGI;
# print header and start the markup output # Напечатать заголовок и начните разметки выходной
print $q->header( “text/html” ),$q->start_html( “hello from perl cgi!” ); распечатать $ q-> заголовок ( "текст / html"), $ q-> start_html ( "привет из perl cgi!");
print $q->h2(”hello dave…”); распечатать $ q-> h2 ( "привет dave…");
print $q->end_html; распечатать $ q-> end_html;
# end code # Конец кода
Now go to Теперь переходим к http://localhost/cgi-bin/test.cgi (scripts in Apache2/cgi-bin/ are read as http://localhost/cgi-bin/ by default). (скрипты в Apache2/cgi-bin / читаются как http://localhost/cgi-bin/ по умолчанию). You should see a page that displays a level two heading with the following text: Вы должны увидеть страницу, которая отображает два уровня с заголовком следующий текст:
hello dave привет dave
If you see the above message, CGI is running. Если вы видите выше сообщение, CGI выполняется. 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. Если вы получите 500 ошибку, перейдите к последней записи в вашем Apache2/logs/error.log (или Обзор Ошибка Войдите в меню "Пуск"), чтобы посмотреть именно то, что в результате этой ошибки.
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. ВАЖНО: Это машина переведена страница, на которой предоставляется "как есть" без гарантий. Machine translation may be difficult to understand. Машинный перевод может быть трудным для понимания. Please refer to Обратитесь к original English article Английский оригинал статьи whenever possible. когда это возможно.
Share and contribute or get technical support and help at Доля и вклад или получить техническую поддержку и помощь в My Digital Life Forums Моя Цифровая жизнь форумах .
Related Articles Статьи по теме
- Install AWStats- Free Logfile Analyzer for Site Statistics Установить AWStats-Free анализатор лог-файл для статистики сайта
- Easily Set Up Web Server with XAMPP Легко настроить веб-сервер с XAMPP
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4 Установка веб-сервера в Windows XP с Apache2, PHP5 и MySQL4 - Часть 4
- CPAN Missing Parameter auto_commit Message CPAN пропавших без параметра auto_commit сообщение
- Internal Error 2739 Error in Vista (32 or 64-bit) When Install Adobe Photoshop CS3 and Reflector Related Programs Внутренняя ошибка 2739 Ошибка в Vista (32 или 64 бит) При установке Adobe Photoshop CS3 и программ, относящихся к Reflector
- Enable and Display Security Tab in Windows XP Home Edition Подключение и отображения на вкладке безопасность в Windows XP Home Edition
- eMule 0.48a for Windows Vista Free Download эМюль 0.48a для Windows Vista Free Download
- Hack and Workaround to Clean or Fresh Install Windows Vista with Upgrade License DVD Hack и обходным к чистой или свежие установки Windows Vista при обновлении лицензии на dvd
- Trick to Install Windows XP SP3 RC in Non-English Language Editions Trick установить Windows XP SP3 RC в не-английском языках
- Download Yahoo! Скачать Yahoo! Messenger with Voice 8 Full Standalone Installer Messenger с голосом 8 полном автономном установки

































January 2nd, 2006 02:19 2 января 2006 года 02:19
[...] As AWStats is Perl based, a Perl Interpreter need to be installed first to take anvantage of AWStats. [...] Как AWStats является Perl основе, Интерпретатор Perl должны быть установлены первые принять anvantage из AWStats. For instruction on how to install Perl in Windows machine, check out this article. В инструкции по установке Perl в Windows машины, ознакомьтесь с этой статьей. [...]
July 25th, 2006 20:53 25 июля 2006 20:53
I have installed cgi and configured apache as you said, but i got this erro: Я установил cgi apache и настроен, как вы сказали, но я получил эту erro:
Internal Server Error Внутренняя ошибка сервера
The server encountered an internal error or misconfiguration and was unable to complete your request. Сервер сталкиваются внутренние ошибки или неправильной и не смог завершить свой запрос.
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. Обратитесь к администратору сервера, веб-мастер @ lokalny_host и информировать их о времени произошла ошибка, и все, что вы могли бы сделать, что может быть причиной ошибки.
More information about this error may be available in the server error log. Подробнее об этой ошибке могут быть доступны в лог ошибок сервера.
——————————————————————————– ---------------------------
Apache/2.0.58 (Win32) PHP/5.1.4 Server at localhost Port 80 Apache/2.0.58 (Win32) PHP/5.1.4 Server на локальный порт 80
May 10th, 2007 19:25 10 мая 2007 19:25
Cool4you,guys. Cool4you, ребята.
June 20th, 2007 08:09 20 июня 2007 08:09
Just for the record, the above test script throws a 500 error when used as is. Просто для записи, выше тестового скрипта броски 500 ошибку, когда используются как есть. 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 Может быть, это просто проблема с firefox отображения текста или что-нибудь, но кавычки являются перепутали, так что может привести к возникновению проблем
October 8th, 2007 23:05 8 октября 2007 23:05
Hi all, Привет всем,
I really need some help on this subject =) Я действительно нужна помощь по данному вопросу =)
I have followed the steps above, and changed the quotation marks, and what I get is 9 error messages: Я следовал описанные выше, и изменила кавычках, а что я получаю составляет 9 сообщений об ошибке:
Backslash found where operator expected at Z.\test.cgi line 1, near “rtf1\” Найти обратную косую черту, где оператор ожидается на З. \ test.cgi линии 1, возле "rtf1 \"
or …. или…. , near “ansi\” , Возле "ansi \"
or …. или…. , near “deff0″ , Возле "deff0"
or …. или…. , near “f1\” , Возле "f1 \"
etc.. т.д..
I am a total rookie with these things, any help appreciated =) Я в общей сложности с rookie эти вещи, любая помощь оценили =)
Thanks, Спасибо,
Johanna
November 28th, 2007 22:14 28 ноября 2007 22:14
I did everything you said. Я сделал все, что вам сказал. But cgi is still not running. Но cgi-прежнему не работает. Please help. Пожалуйста, помогите.
my apache is 2.2 моя apache составляет 2,2