Configuring Apache Server and Perl for CGI T.A. Maisa Khudair Dr. Qusai Abu Ein.

Slides:



Advertisements
Similar presentations
CGI Scripting and Vulnerabilities COEN 351: E-commerce Security  Thomas Schwarz, S.J
Advertisements

How does the server format the information it gives to the appln program? As environment variables and in standard input.
CGI. XML2 Common Gateway Interface n Georgia Tech 1995 Web Usage Survey –Perl % –C % –Shell Scripts - 8.1% –Tcl - Tool Commercial Language.
CGI & Perl Programming Language What is CGI? Introduction of Perl Programming Language –Simple Peal program –Perl variables –Perl Operators –Flow Controls.
Web Services Nov 26, 2002 Topics HTTP Serving static content Serving dynamic content class27.ppt “The course that gives CMU its Zip!”
PZ15A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ15A - The Internet Programming Language Design and.
Lecture 9, : The Internet, Summer : The Internet Lecture 9: Web Services II David O’Hallaron School of Computer Science and Department.
What is CGI? The Common Gateway Interface (CGI) is a mechanism that allows Web clients to execute programs on a Web server and to receive their output.
Outcomes Know what are CGI Environment Variables Know how to use environment variables How to process A simple Query Form Able to use URL Encoding rules.
Dynamic Web site With PHP and MySQL. MySQL The combination of MySQL database and PHP scripting language is optimum for building dynamic websites. MySQL.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
1 Web Servers Web Protocols and Practice Chapter 4.
Linux Operations and Administration
Common Gateway Interface
Setting up Greenstone for your organization Course material prepared by Greenstone Digital Library Project University of Waikato, New Zealand andNational.
Appendix: Installing AMP (Apache + MySQL + PHP). Training Course, CS, NCTU 2 AMP  AMP A – Apache Web Server M – MySQL Database Server P – PHP Language.
CS 1704 Introduction to Data Structures and Software Engineering.
Overview A plain HTML document is static A CGI program is executed in real-time, so that it can output dynamic information. CGI (Common Gateway Interface)
CP3024 Lecture 3 Server Side Facilities. Lecture contents  Server side includes  Common gateway interface (CGI)  PHP Hypertext Preprocessor (PHP) pages.
Apache Server The Apache Server Apache is a WWW server that implements the HTTP protocol. Apache runs as a daemon. This means that it is a resident.
Web Servers1-1 Web Servers Xingquan (Hill) Zhu
CGI Lecture 7 cs193i – Internet Technologies Summer 2004 Stanford University.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
CGI Scripting and Vulnerabilities COEN 351: E-commerce Security  Thomas Schwarz, S.J
Nic Shulver, Intro: Developing Server Applications What is a server? Many types of server – File server – file: networked file.
Apache + Tomcat. Apache + Tomcat Download mod_webapp.so:
Web Services Topics HTTP Serving static content
Web Server Design Week 14 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/14/10.
CSU - DCE Advanced Perl CGI Operation - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to the Common Gateway Interface (CGI) on the.
Building PERL Scripts on a Windows system* *and running those scripts on an Apache server!
CSCE Systems Programming Lecture 21 Web Server: CGI -Dynamic Pages CSCE March 25, 2013.
CGI programming Peter Verhás January What this tutorial is about Introduction to CGI programming Using ScriptBasic –Simple to program –Simple to.
1 CGI with perl. 2 References Perl tutorials and references:
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
ELECTRONIC COMMERCE- Framework, Technologies and Applications © Tata McGraw-Hill 1 Electronic Commerce: Information Publishing Technology.
Perl: Lecture 2 Advanced RE & CGI. Regular Expressions 2.
Perl CGI What is "CGI"? Common Gateway Interface A means of running an executable program via the Web. Perl have a *very* nice interface to create CGI.
CGI Scripting and Vulnerabilities COEN 351: E-commerce Security.
CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to the Common Gateway Interface (CGI) Instructor: Joseph DiVerdi,
1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development.
Form Data Encoding GET – URL encoded POST – URL encoded
Internet and Intranet Fundamentals
Shellshock a.k.a. Bashdoor / Bash bug
Multi-Domain Hosting Hosting multiple domains on one server using Apache John Beckett 1/16/2013.
LING 408/508: Programming for Linguists Lecture 17 October 28 th.
WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages.
Web Services November 30, 2004 Topics HTTP Serving static content Serving dynamic content “The course that gives CMU its Zip!” class26.ppt.
Krerk Piromsopa. 1 Department of Computer Engineering. Chulalongkorn University. Web Application Generic Issues.
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.
Web Server Design Assignment #5: Unsafe Methods & CGI Due: 05/05/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin.
CS 330 Class 8 Homework A pattern that contains a word with an optional period A pattern that contains Fred with a space (not Freddy) See regexp.txt guest4.htm.
Introduction to CGI PROG. CGI stands for Common Gateway Interface. CGI is a standard programming interface to Web servers that gives us a way to make.
Outline  XAMPP  XAMPP Install  Put php and HTML documents  Windows and Mac Version  Security.
Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson 04/03/12.
Web Server Design Week 15 Old Dominion University Department of Computer Science CS 495/595 Spring 2009 Michael L. Nelson 4/20/09.
1 The Internet Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.
9/21/04 James Gallagher Server Installation and Testing: Hands-on ● Install the CGI server with the HDF and FreeForm handlers ● Link data so the server.
Apache Tomcat & Quick Tutorial
Shellshock a.k.a. Bashdoor / Bash bug
Web & Web applications DBW 2017.
Web Protocols and Practice
Web Server Design Assignment #5: Unsafe Methods & CGI
Introduction to Programming the WWW I
CSCE Systems Programming
The HTTP Protocol COSC 2206 Internet Tools The HTTP Protocol
Environment Variables
An Example of a TCP/IP Application: the World Wide Web
Web Server Design Week 16 Old Dominion University
MSc Internet Computing
Presentation transcript:

Configuring Apache Server and Perl for CGI T.A. Maisa Khudair Dr. Qusai Abu Ein

Setting up Apache for Windows Install Apache Server from following web site: Install Apache Server from following web site: Choose the Win32 Binary (MSI Installer): apache_2.2.4-win32-x86-no_ssl.msi Choose the Win32 Binary (MSI Installer): apache_2.2.4-win32-x86-no_ssl.msi apache_2.2.4-win32-x86-no_ssl.msi To start using CGI, you have to download ActivePerl from following web site: To start using CGI, you have to download ActivePerl from following web site:

Cont ’ d Get the Windows (x86) MSI version Get the Windows (x86) MSI version To activate CGI in Perl, use your Notepad Editor To activate CGI in Perl, use your Notepad Editor open E:\Apache2_2\conf\httpd.conf open E:\Apache2_2\conf\httpd.conf (note: Path in PINK is the path you had installed your ActivePerl to in your computer) (note: Path in PINK is the path you had installed your ActivePerl to in your computer) search for Options Indexes FollowSymLinks search for Options Indexes FollowSymLinks

Cont ’ d when you find it add ExecCGI to the end so it looks like Options Indexes FollowSymLinks ExecCGI when you find it add ExecCGI to the end so it looks like Options Indexes FollowSymLinks ExecCGI Always keep writing this line at the beginning of your CGI file: Always keep writing this line at the beginning of your CGI file: #!E:/Perl/bin/perl.exe #!E:/Perl/bin/perl.exe To start using Apache Server, go to Start Menu, search for Apache Http Server, then To start using Apache Server, go to Start Menu, search for Apache Http Server, then Control Apache Server > Start Control Apache Server > Start

Testing Apache Server To test your Apache Server working, go to your browser web page, type in the address bar the following: To test your Apache Server working, go to your browser web page, type in the address bar the following: If you got a message telling you: If you got a message telling you: It works! Your server is working well. It works! Your server is working well.

Writing CGI Scripts In order to execute your CGI scripts, you have to put them in cgi-bin folder located in your Apache Directory in your PC In order to execute your CGI scripts, you have to put them in cgi-bin folder located in your Apache Directory in your PC Your files should be saved like this: Your files should be saved like this: fileName.cgi fileName.cgi To run your CGI, type: To run your CGI, type:

First CGI Example #!d:/Perl/bin/perl.exe print "Content-type: text/html\n\n"; print "Hello, World."; print "This is ME!!";

Output Hello, World This is ME!!

Cont ’ d :Environment variables example #!d:/Perl/bin/perl.exe## ## printenv -- demo CGI program which just prints its environment ## print "Content-type: text/plain; charset=iso \n\n"; foreach $var (sort(keys(%ENV))) { $val = $ENV{$var}; $val = $ENV{$var}; $val =~ s|\n|\\n|g; $val =~ s|\n|\\n|g; $val =~ s|"|\\"|g; $val =~ s|"|\\"|g; print "${var}=\"${val}\"\n"; print "${var}=\"${val}\"\n";}

Output DOCUMENT_ROOT = /usr/local/etc/apache/htdocs GATEWAY_INTERFACE = CGI/1.1 HTTP_ACCEPT = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* HTTP_ACCEPT_CHARSET = iso ,*,utf-8 HTTP_ACCEPT_LANGUAGE = en HTTP_CONNECTION = Keep-Alive HTTP_HOST = :8080 HTTP_USER_AGENT = Mozilla/4.01 [en] (Win95; I) PATH = /usr/local/bin:/bin:/etc:/usr/bin QUERY_STRING = REMOTE_ADDR = REMOTE_HOST = REMOTE_PORT = 1029 REQUEST_METHOD = GET REQUEST_URI = /cgi-bin/utils/printenv.cgi SCRIPT_FILENAME = /usr/local/lib/apache/cgi-bin/utils/printenv.cgi SCRIPT_NAME = /cgi-bin/utils/printenv.cgi SERVER_ADMIN = SERVER_NAME = coyote.acme.com SERVER_PORT = 8080 SERVER_PROTOCOL = HTTP/1.0 SERVER_SOFTWARE = Apache/1.2.5 TZ = :US/Eastern DOCUMENT_ROOT = /usr/local/etc/apache/htdocs GATEWAY_INTERFACE = CGI/1.1 HTTP_ACCEPT = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* HTTP_ACCEPT_CHARSET = iso ,*,utf-8 HTTP_ACCEPT_LANGUAGE = en HTTP_CONNECTION = Keep-Alive HTTP_HOST = :8080 HTTP_USER_AGENT = Mozilla/4.01 [en] (Win95; I) PATH = /usr/local/bin:/bin:/etc:/usr/bin QUERY_STRING = REMOTE_ADDR = REMOTE_HOST = REMOTE_PORT = 1029 REQUEST_METHOD = GET REQUEST_URI = /cgi-bin/utils/printenv.cgi SCRIPT_FILENAME = /usr/local/lib/apache/cgi-bin/utils/printenv.cgi SCRIPT_NAME = /cgi-bin/utils/printenv.cgi SERVER_ADMIN = SERVER_NAME = coyote.acme.com SERVER_PORT = 8080 SERVER_PROTOCOL = HTTP/1.0 SERVER_SOFTWARE = Apache/1.2.5 TZ = :US/Eastern

Any Questions??