Building PERL Scripts on a Windows system* *and running those scripts on an Apache server!

Slides:



Advertisements
Similar presentations
1 Copyright © 2002 Pearson Education, Inc.. 2 Chapter 2 Getting Started.
Advertisements

Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 11: Advanced Web Technologies.
Chapter 4: Introduction to Perl and CGI programming. PERL -- Practical Extraction and Report Language Developed in 1980's by Larry Wall He created it to.
ASP Tutorial. What is ASP? ASP (Active Server Pages) is a Microsoft technology that enables you to make dynamic and interactive web pages. –ASP usually.
Building Web Pages With Microsoft Office. Introduction This tutorial is for the beginning web builder. It utilizes software that you already have, Microsoft.
CIS101 Introduction to Computing Week 05. Agenda Your questions CIS101 Survey Introduction to the Internet & HTML Online HTML Resources Using the HTML.
HTML Recall that HTML is static in that it describes how a page is to be displayed, but it doesn’t provide for interaction or animation. A page created.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Website Development with PHP and MySQL Introduction.
Images By Tara Frieszell By Tara Frieszell. Adding images to your website will make it more interesting and add to the design. However, some viewers aren’t.
Creating an HTML page Skills: edit and debug HTML pages IT concepts: text editor This work is licensed under a Creative Commons Attribution-Noncommercial-
CGI programming Using Apache. Concepts Browser prepares parameter list List is attached to name of program to run on server "submit" button sends string.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Web Client/Server Communication A290/A590, Fall /09/2014.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 21: Publishing Your Pages on the Web.
Making Your Web Page Interactive with CGI TLN Technology Committee February 16, 1999.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
Perl/cgi and an Access Database Please use speaker notes for additional information!
Server Side Scripting Norman White. Where do we do processing? Client side – Javascript (embed code in html) – Java applets (send java program to run.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Web Administration.
1 Homework / Exam Exam 3 –Solutions Posted –Questions? HW8 due next class Final Exam –See posted schedule Websites on UNIX systems Course Evaluations.
CNIT 132 Intermediate HTML and CSS Publish Web Page.
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
INE1020 Introduction to Internet Engineering Tutorial 8 All about Lab 6.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
About Dynamic Sites (Front End / Back End Implementations) by Janssen & Associates Affordable Website Solutions for Individuals and Small Businesses.
CPSC203 Introduction to Computers Lab 69 By Jie Gao.
2 1 Sending Data Using a Hyperlink CGI/Perl Programming By Diane Zak.
Perl Web Page – Just Enough Pepper. Web site Set up the top of your script to indicate perl and plain text #!/usr/bin/perl print "Content-type:text/plain\n\n";
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 6.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Websites 101 Technology Committee UPSOM. Web Class – Goals  Make a simple web page (or series of pages)  Upload that page to the internet  Feel comfortable.
CSU - DCE Advanced Perl CGI Operation - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to the Common Gateway Interface (CGI) on the.
FTP Server and FTP Commands By Nanda Ganesan, Ph.D. © Nanda Ganesan, All Rights Reserved.
Python From the book “Think Python”
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
1 Basic Perl CGI Programming. 2 Issues How and when your program is invoked. Generating Response –HTTP Headers –HTML (or whatever document type you want)
11 1 Cookies CGI/Perl Programming By Diane Zak Objectives In this chapter, you will: Learn the difference between temporary and persistent cookies.
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
Topics Sending an Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies.
SIR and the WEB By Dave Doulton University of Southampton.
Introduction to CGI/Perl Please use speaker notes for additional information!
Introduction to JavaScript CS101 Introduction to Computing.
10 1 Hidden Fields and CGI/Perl Programming By Diane Zak.
ECMM6018 Enterprise Networking for Electronic Commerce Tutorial 7
Implementing and Using the SIRWEB Interface Setup of the CGI script and web procfile Connecting to your database using HTML Retrieving data using the CGI.
MySQL Getting Started BCIS 3680 Enterprise Programming.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
Form Processing Week Four. Form Processing Concepts The principal tool used to process Web forms stored on UNIX servers is a CGI (Common Gateway Interface)
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
PHP Syntax You cannot view the PHP source code by selecting "View source" in the browser - you will only see the output from the PHP file, which is plain.
PHP Form Processing * referenced from
Sessions and cookies (part 2) MIS 3501, Fall 2015 Brad N Greenwood, PhD Department of MIS Fox School of Business Temple University 11/19/2015.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Sending data with CGI/Perl Please use speaker notes for additional information!
Lesson 11. CGI CGI is the interface between a Web page or browser and a Web server that is running a certain program/script. The CGI (Common Gateway Interface)
University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
Introduction to Programming the WWW I
PHP Introduction.
Intro to PHP & Variables
Module 1 Introduction to PHP 11/30/2018 CS346 PHP.
Tutorial 10: Programming with javascript
Web Application Development Using PHP
Presentation transcript:

Building PERL Scripts on a Windows system* *and running those scripts on an Apache server!

Tools Used Windows XP service pack 3 computer GoDaddy account for hosting Domain name Filezilla for FTP access DOS to Unix conversion tool

The Dilemma I wanted to further master my web programming skills after completing HTML, Javascripting and PHP courses at Chaffey I signed up for Perl/CGI Hosted my website with GoDaddy after discussing my needs with them I then found for CGI, they use an Apache server! This created the need to learn how to convert DOS (Windows) derived files into Unix/Linux files so the server would be able to run them correctly

The Solution I found, after quite a bit of searching and testing, a simple and powerful utility which will translate “fromDOS” or “toDOS” based on the user’s needs Now, the process…

Build a Set of Files Build the html page first Point the html to the cgi file Upload the HTML page to the web server Build the CGI file(s) Convert the cgi file(s) into Unix type file(s) Upload the converted cgi to the web server using Filezilla  Change the cgi file attributes to 755  Disconnect from the server Test by connecting to the html web page

HTML Page Jubilee Book Club Jubilee Book Club Home Page Click the book to sign in Points to the CGI file

CGI Script (yes, it is a bit small; bear with me) #!/usr/bin/perl #book1.cgi - displays a sign-in form print "Content-type: text/html\n\n"; use CGI qw(:standard); use strict; #declare variable my $name; #retrieve Name cookie $name = cookie('Name'); print " \n"; print " Jubilee Book Club \n"; print " \n"; print " Jubilee Book Club Sign-In Form \n"; print "<FORM \n"; print "ACTION='book2.cgi' \n"; print "METHOD=POST>\n"; print " \n"; print " Name: \n"; print " \n";

CGI Script Described Shebang line  UNIX – #!/usr/bin/perl (be very careful to get this right; I once spent hours debugging a script only to discover I had typo’d on this line) File name and description of what the file will perform - #book1.cgi - displays a sign-in form Declare the type of page - print "Content-type: text/html\n\n"; - HTML for example Use the # for comments

CGI Script Described (continued) Use declarations - use CGI qw(:standard); - to tell Perl what module to use Prevent Perl from creating undeclared - use strict; Perl statements end with a semi-colon Declare variable - my $name; Add a cookie - $name = cookie('Name');

CGI Script Described (continued) Print/Return an HTML page Code in much the same way as a standard HTML page with print statements: print " \n"; print " Jubilee Book Club \n"; print " \n"; print " Jubilee Book Club Sign-In Form \n"; print "<FORM \n"; print "ACTION='book2.cgi' \n"; print "METHOD=POST>\n";

CGI Script Described (continued) print " \n"; print " Name: \n"; print " \n"; Remember to close each object! This cgi also points to a 2 nd cgi file containing the cookie, which will greet the customer

CGI Script Described (continued) Open the 2 nd CGI file in same manner as the first with a different file name: #!/usr/bin/perl #book2.cgi - displays a Web page containing the user's #name and the book information use CGI qw(:standard); use strict; #declare variables my ($name, $C_name); #assign input to variable $name = param('Name');

CGI Script Described (continued) Create the cookie: $C_name = cookie(-name => "Name", (input from the form) -value => "$name", (variable to save) -path => "/cgi", (path where to save the cookie) -expires => "+6M"); (how long to save the cookie) Send the cookie to the browser: print header(-cookie => $C_name);

CGI Script Described (continued) Create the response web page: print " \n"; print " Jubilee Book Club \n"; print " \n"; print " Hello, $name! \n"; print "The book of the month is \n"; print " \n"; print " The Case of the Missing Dagger \n"; print " by H.T. Sims\n"; print " \n"; Script is now complete

Format the CGI File(s) After following the simple directions in their readme file and installing “fromDOS”  Open a command prompt  Change directory to the location of the cgi file(s)  Type fromDos filename.cgi and press Enter The file is now compatible with Unix  Type perl –c filename.cgi and press Enter Perl starts the perl interpreter -c checks the syntax without executing  If no errors, proceed to upload

Uploading the CGI files Open Filezilla  Set up a connection to the server with appropriate user name and password  Left side window is location of local files  Right side window is location of server side files  Usually cgi-bin is the desired directory for cgi files, but GoDaddy uses CGI as their directory Upload the converted files to the server’s CGI folder Right click on the server files and select File Attributes Change attributes to 755 and disconnect when complete

Testing Open a Browser  Connect to the path of the HTML file uploaded  Complete the form as necessary  Determine if the results are as expected  Finished