Apache CentOS WebServer and The Three Ps Primer Tutorial

Apache CentOS WebServer and The Three Ps Primer Tutorial (try twirling round bottom of image for a synopsis ... 'do the twirl now')

Apache CentOS WebServer and The Three Ps Primer Tutorial (try twirling round bottom of image for a synopsis ... 'do the twirl now')

Today’s tutorial shows a web scenario that utilizes The Three P’s with the rjmprogramming.com.au Apache CentOS web server ( at //www.rjmprogramming.com.au/ ), building on the previous relevant Apache WebServer on Mac and The Three P’s Primer Tutorial, as shown below, which truly integrated the Three P’s on a Mac laptop (Mac OSX 10.7.5, Apache/2.2.22 (Unix), mod_wsgi/3.3, Python/2.6.7, PHP/5.3.15) opening up its Web Sharing arrangements, which, itself, built on the previous Perl Form Validation Primer Tutorial. Please note that any additional MAMP local WebServer can live with this arrangement as a separate local webserver on HTTP://localhost:8888/

The scenario of full control over your web server is most likely on a local webserver, but, often with hosted arrangements, you are not allowed to have things your way, and the rjmprogramming.com.au CentOS hosting has PHP as the server-side language, with Perl as the cgi-bin language, leaving out our Slytherin friend, Python. However, as mentioned in yesterday‘s Python List Primer Tutorial, there is a way to use the Three P’s together as a team, even so, making use of the PHP exec command.

So what is the role of the Three P’s today … well, Python = First Witch, PHP = Second Witch and Perl = Third Witch … yes, we create a webpage for Macbeth Act 1 Scene 1 by William Shakespeare. To be honest, my first idea was to splice Lionel Ritchie’s Hello into Jenny by Flight of the Conchords (you may be pleased to know it couldn’t be made to work?!).

The way it works is that PHP supervises Python and Perl via exec, piecing together the Scene with background imagery and effects (when you run the tutorial, there will be sound).

Download PHP source code and rename to conversation_supervisor.php
Download Perl programming source code and rename to conversation1.perl, conversation2.perl, conversation3.perl
Download Python programming source code and rename to conversation1.py, conversation2.py, conversation3.py

Remember with the Perl and Python in these scenarios that the execute bit of the file permissions should be set.

Thanks to:


Previous relevant Apache WebServer on Mac and The Three P’s Primer Tutorial is shown below.

Apache WebServer on Mac and The Three P's Primer Tutorial

Apache WebServer on Mac and The Three P's Primer Tutorial

Today’s tutorial shows a web scenario that utilizes The Three P’s with a local Apache web server (at HTTP://localhost/) on a Mac laptop (Mac OSX 10.7.5, Apache/2.2.22 (Unix), mod_wsgi/3.3, Python/2.6.7, PHP/5.3.15) opening up its Web Sharing arrangements, building on the previous Perl Form Validation Primer Tutorial. Please note that any additional MAMP local WebServer can live with this arrangement as a separate local webserver on HTTP://localhost:8888/

In our tutorial we use a PHP web page HTML form element to perform a dice guessing game via the use of a Python CGI application using the mod_wsgi.so Apache module which required some installation and configuration, for which the links below are of interest:

In the tutorial here, as for the referenced tutorial, we use Perl code to validate a PHP/HTML form element’s input tag data using regular expressions, as described by Wikipedia below:

In computing, a regular expression (abbreviated regex or regexp) is a sequence of text characters, some of which are understood to be metacharacters with symbolic meaning, and some of which have their literal meaning, that together can automatically identify textual material of a given pattern, or process a number of instances of it that can vary from a precise equality to a very general similarity of the pattern. The pattern sequence itself is an expression that is a statement in a language designed specifically to represent prescribed targets in the most concise and flexible way to direct the automation of text processing of general text files, specific textual forms, or of random input strings. A regular expression patterns a match to a string. It is employed in a search to identify text for further processing, such as displaying the match, or altering it; or it is employed to simply inform of the location or count. The concept arose in the 1950s, when Kleene formalized the description of a regular language, and came into common use with the Unix text processing utilities ed, an editor, and grep (global regular expression print), a filter.

This Perl form validation client-side technique uses a GET method, but if you want to hide your data and use a POST method, you may need to do form validation from the server-side using PHP , for example.

By the way the format of the telephone number asked for by this tutorial is for an Australian telephone number which is a 2 or 3 digit area code followed by an 8 digit number. If you can’t get through maybe you can just listen to a song.

Download PHP source code and rename to validateperlpython.php
Download Perl programming source code and rename to validateperl.cgi
Download Python programming source code and rename to index.wsgi (placed in a pythonplace subdirectory, perhaps)
Download configuration file and rename to .htaccess (for a pythonplace subdirectory, perhaps)
Download Apache configuration file and rename to httpd.conf (is the Apache configuration file for my Mac laptop environment, so yours could be similar but different (please use care))

Regarding the form validation aspects to this topic I really like “Perl and CGI for the World Wide Web” by Elizabeth Castro

In researching the form validation aspects to this tutorial topic found the following two sites very useful … Hidden fields, Online Perl Interpreter and Debugging Tool … so, thanks.


Previous Perl Form Validation Primer Tutorial is shown blow.

Perl Form Validation Primer Tutorial

Perl Form Validation Primer Tutorial

In tutorial here we use Perl code to validate an HTML form element’s input tag data using regular expressions, as described by Wikipedia below:

In computing, a regular expression (abbreviated regex or regexp) is a sequence of text characters, some of which are understood to be metacharacters with symbolic meaning, and some of which have their literal meaning, that together can automatically identify textual material of a given pattern, or process a number of instances of it that can vary from a precise equality to a very general similarity of the pattern. The pattern sequence itself is an expression that is a statement in a language designed specifically to represent prescribed targets in the most concise and flexible way to direct the automation of text processing of general text files, specific textual forms, or of random input strings. A regular expression patterns a match to a string. It is employed in a search to identify text for further processing, such as displaying the match, or altering it; or it is employed to simply inform of the location or count. The concept arose in the 1950s, when Kleene formalized the description of a regular language, and came into common use with the Unix text processing utilities ed, an editor, and grep (global regular expression print), a filter.

This Perl form validation client-side technique uses a GET method, but if you want to hide your data and use a POST method, you may need to do form validation from the server-side using PHP , for example.

By the way the format of the telephone number asked for by this tutorial is for an Australian telephone number which is a 2 or 3 digit area code followed by an 8 digit number. If you can’t get through maybe you can just listen to a song.

Download HTML source code and rename to validatepl.html
Download Perl programming source code and rename to validatepl.cgi

Regarding this topic I really like “Perl and CGI for the World Wide Web” by Elizabeth Castro

In researching this tutorial topic found the following two sites very useful … Hidden fields, Online Perl Interpreter and Debugging Tool … so, thanks.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Operating System, Software, Tutorials and tagged , , , , , , , , , , , . Bookmark the permalink.

5 Responses to Apache CentOS WebServer and The Three Ps Primer Tutorial

  1. A couple of months ago I discovered one more website that talked in depth about this subject. I’m glad you were able to shed some light on whatÒ€ℒs really happening out there. Some webistes are overtly biased towards items like this. Exactly where do you believe the industry is going in response to this?

  2. Shame on you for making an additional terrific submit! Awesome stuff, preserve up the superior work. I see a great deal of potential! I wonder if you are an active user with any social networking web sites like Digg or Stumble Upon?

  3. Visual Arts says:

    excellent issues altogether, you just received a emblem new reader. What would you suggest about your post that you simply made a few days in the past? Any positive?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>