- 1 Vapor IO Brings OpenDCRE to General Availability
- 2 VMware Takes the Wraps Off vRealize Automation and vRealize Business
- 3 Microsoft Previews Hyper-V Containers for Windows Server 2016
- 4 Mirantis Led FUEL Project Gets Installed Under OpenStack Big Tent
- 5 Red Hat Enterprise Linux 7.2 Adds Security, DR Features
the program Page 3
Our program will not do anything terribly useful. It is a simple program that will illustrate some essential aspects of installing a Perl program, while acquainting you with your FTP program and some basic Perl syntax. Our program is designed to be called as a server side include (it is called invisibly from a web page and will record some basic information). The first step of our installation will require very little configuration and will test to see if you uploaded the file correctly and set the correct permissions. Lets begin by looking at the program (it is available here for download). Open the program up in your text editor and examine the first couple lines of your program, which should read:
2 # This line says "Hey, Man, I'm a Perl program!"
3 # It points to the Location of the Perl Interpreter on your server.
4 # This tells the server that your program
5 # needs to be interpreted/executed
6 # Some windows environments will not require this line
The first line tells the server that the program needs to be interpreted and points to the location of Perl on your server. You should consult your ISP to find the exact path (sometimes it is #!/usr/local/bin/perl). Lines 2-6 are standard Perl comments. Anything after the # is considered a comment and is not processed by the Perl interpreter (the first line being the exception). A comment can appear anywhere in a Perl program, even after a valid expression. If you have the program pointing to the correct location of Perl on your system we can now upload it (in ASCII or text mode) to the server. Some ISPs or servers require that you place all of your scripts in the /cg-local/ or /cgi-bin/ directory, while others will allow you to execute a script in any folder or directory. You should again consult your ISP to find out. After you upload the script to the appropriate directory, lets set its permissions, or chmod the file 755 as in the above matrix example.
After you have done this, it is time to see if you have done it right. Launch your Internet browser and type in the URL to your script (http://www.yourdomain.com/cgi-bin/script.cgi?exec). You will notice that I added on a query string at the end of the script name. By adding the ? and the word exec, I am calling a specific function of the script, or passing it a query string. If the script was uploaded correctly and the permissions were correctly set you should see:
Hey, Man, it worked!
Wednesday April 29, 1998
If it worked, congratulations! If it didnt work, skip ahead to the trouble shooting section to see if you can figure out what is wrong.