The Hostway Blog

Linux Series Part 2: Scripting

In this series we’re looking at the Linux operating system (OS) as a Web hosting platform. In the series overview, we looked at how Linux was developed and its popularity. Later we will look at MySQL database software, and at the open source movement. In this article, we’re focusing on scripting languages used on Linux OS.

Linux, like UNIX, was designed to run a series of small programs, each taking input data, performing a single operation and outputting new data, which could then be “piped” to the next program. The original purpose of scripts was to act as the “glue” that joined these programs together, thereby separating the “what to do” instructions from the “how to do it” methodology.

This separation of application design and function implementation has two major effects. First, it frees Web developers up to build more ambitious applications without having to know the technicalities of low level programming. Second, it increases compatibility between programming languages.

If you’re going to be using a Linux Web host, here are the major scripts you should be aware of:

Shell Scripting

Linux hosting supports Secure Shell (SSH) access that enables you to control your server remotely via the Command Line Interface (CLI) over a secure encrypted connection. If you find you have small repetitive tasks you have to perform, you might want to use Bash or a similar shell scripting language to automate the process. You might also find it useful to learn the basics of Gawk, if you expect to perform large-scale data manipulation from the command line.

CGI and Perl

CGI is not a scripting language, but the Common Gateway Interface that enables the Web server software to connect with the CLI in order to generate dynamic Web pages. Although CGI is language agnostic, and can connect the Web server scripts in any language available to the host, Perl is the language most associated with it. Perl was an early forerunner in the race to build useful Web applications, and remains a popular choice. Perl is flexible and fast, and has the mantra “there is more than one way to do it.”

Python

Python is a high-level language that aims to combine “remarkable power with very clear syntax.” The paradox of Python is although it's designed to support multiple programming methods, from object oriented and structured, to functional and imperative, at the same time its developers believe in “one obvious way to do it.” Python is often criticized for being slow and prizing clarity over speed, preferring to plug in modules written in C or other lower level languages where speed is imperative rather than complicate the code.

Ruby

Ruby is described as “A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.” Although it hasn’t to date achieved the popularity of Perl, Python and PHP, the Ruby Summer of Code aims to engage students in the Ruby community, thereby ensuring future development.

PHP

PHP is perhaps the closest thing to a de-facto standard scripting language available online. In the Tiobe Programming Community Index PHP consistently ranks as the most popular high-level language. One good reason for this is it was developed specifically for the Web, the original name being Personal Home Pages. Another is the ease of entry for new programmers, with a wide range of Web applications being available for installation on hosting accounts.

All of these CGI scripting languages have been ported to Windows, so it is possible to run scripts designed for them on Windows servers, although some scripts and functions can behave unpredictably.

Read the other articles in this series:

Linux Web Hosting Part 1: Overview
Linux Web Hosting Part 2: Scripting
Linux Web Hosting Part 3: Databases
Linux Web Hosting Part 4: Conclusion