Wesbytes Knowledge Base

Search our articles or browse by category below

How can I run Perl or CGI Scripts on Windows Servers?

Last modified: June 17, 2022
You are here:
Estimated reading time: 2 min

You can upload the scripts to /cgi-bin folder.
Here is the path for the perl.exe c:perlbinperl.exe.

Therefore, to run the CGI scripts, please rename all the files to extension .pl . You may relocate all the CGI scripts into the scripts folder.

Please remember to CHMOD them.
Normally you need to CHMOD 755 which you can do via FTP software.

What is a CGI Script?

A CGI script is a short programme, often known as a script, that runs on a Web server. It usually generates some kind of dynamically created Web page, such as a guestbook page or data from a database.

The acronym CGI stands for Common Gateway Interface. It’s just a way for Web servers to launch other programmes or scripts when a Web browser requests it.

CGI programmes or scripts can be written in any programming language as long as the end result is something the server can execute. CGI programmes, on the other hand, are typically written in Perl.

In other words, once you’re uploaded the script, you usually need to set its permissions.

What is Perl?

Perl is a scripting language that is powerful and flexible. Perl is also an interpretive language. This means you can make changes to a Perl script and immediately see the results unlike the C programming, where you have to recompile the programme each time. As a result, Perl is ideal for CGI scripting.

What does a CGI script actually look like?

Here is very simple CGI script written in Perl. Don’t worry if you don’t understand it at this point. We’ll explain this script in more detail in a later tutorial!

#!/usr/bin/perl

print "Content-type: text/html\n\n";

print <<END_HTML;

Hello, World!

END_HTML

This CGI script simply displays a Web page containing the text “Hello, World!”.

A CGI script is a file, just like a Web page, or a GIF image. The main difference is that CGI scripts are actually run by the Web server, whereas images and Web pages are simply displayed.

How do I run a CGI script on my Web Server?

A CGI script is a file, just like a Web page, or a GIF image. The main difference is that CGI scripts are actually run by the Web server, whereas images and Web pages are simply displayed.

Usually, you will need to upload your CGI scripts to your Web server, just like you upload your Web pages and images (often using FTP). On most Web servers you will need to upload it to the cgi-bin folder on your site.

Was this article helpful?
Dislike 0
Views: 31