Question 1. What Do I Absolutely Need To Know In Cgi?
If you are already a programmer,CGI is extremely trustworthy, and just three assets have to get you up to speed inside the time it takes to read them:
Installation notes to your HTTPD.Is it configured to run CGI scripts, and if so how does it pick out that a URL need to be completed? (Check your manuals, READMEs, ISP webpages/FAQS, and in case you still can't locate it ask your server administrator).
The CGI specification at NCSA tells you all you need to recognize to get your applications running as CGI packages.
WWW Security FAQ. This is not required to 'get it working', however is essential reading in case you want to KEEP it running!
If you are NOT already a programmer, you'll should study. If you will discover it hard to jot down, say, a 'grep' or 'cat' application to run from the commandline, then you may in all likelihood have a hard time with CGI. Make positive your packages work from the commandline BEFORE trying them with CGI, so that at the least one feasible source of errors has been handled.
Question 2. Do I Have To Use Perl?
No - you could use any programming language you please. Perl is simply modern-day maximum famous preference for CGI packages. Some different widelyused languages are C, C++, TCL, BASIC and - for easy obligations -even shell scripts.
Perl Scripting Interview Questions
Question 3. Can I Identify Users/periods Without Password Protection?
The maximum typical (however browser-based) manner to do this is to set a cookie. If you do that, you're accepting that now not all users will have a 'consultation'.
An opportunity is to skip a session ID in every GET URL, and in hidden fields of POST requests. This can be a large overhead until _every_ web page requires CGI anyhow.
Another opportunity is the Hyper-G solution of encoding a session-identity inside the URLs of pages lower back:
This has the downside of creating the URLs very difficult, and causes any bookmarked pages to generate old session_ids.
Note that a consultation ID based totally on REMOTE_HOST (or REMOTE_ADDR) will NOT paintings, as more than one users might also access your pages simultaneously from the equal gadget.
Question four. How Can I Stop My Cgi Script Reading And Writing Files As Nobody?
CGI scripts are run by using the HTTPD, and therefore through the UID of the HTTPD process, that's (through convention) typically a unique person "nobody".
There are primary methods to run a script underneath your own userid:
(1) The direct technique: use a setuid application.
(2) The double-server technique: have your CGI script speak with a second manner (e.G. A daemon) going for walks below your userid, that's responsible for the actual document control.
The direct technique is commonly quicker, however the client-server structure may additionally help with other troubles, such as keeping integrity of a database.
When jogging a compiled CGI software (e.G. C, C++), you could make it setuid via certainly placing the setuid bit:
e.G. "chmod 4755 myprog.Cgi"
For security motives, this is not feasible with scripting languages (eg Perl, Tcl, shell). A workaround is to run them from a setuid software, such as cgiwrap.
In maximum instances wherein you'd need to apply the client-server technique, the server is a finished product (along with an SQL server) with its own CGI interface.
A light-weight opportunity to that is Don Libes' "anticipate" package.
Perl Scripting Tutorial
Question 5. Do I Need To Be On Unix?
No, but it enables. The Web, along side the Internet itself, C, Perl, and almost every other Good Thing in the closing twenty years of computing, originated in Unix. At the time of writing, that is nonetheless the most mature and first-rate-supported platform for Web applications.
Oracle Interview Questions
Question 6. Are There Some Interactive Debugging Tools And Services Available?
Several CGI programming libraries provide powerful interactive debugging centers. These encompass:
- for Perl, Lincoln Stein's CGI.Pm
(now part of the usual Perl distribution)
- for Tcl, Don Libes' cgi.Tcl
- for C++, Nick Kew's CGI++
Nathan Neulinger's cgiwrap is any other package with debugging aids.
The "mod_cgi" Apache module (new with Apache 1.2) allows you to seize script output and mistakes for prognosis.
Question 7. Explain Is Cgi A Script Or A Program?
The distinction is semantic.Traditionally, compiled executables(binaries) are called applications, and interpreted programs are usually called scripts.In the context of CGI,the difference has come to be even more blurred than earlier than.The words are regularly used interchangably (consisting of on this file).Current utilization favours the phrase "scripts" for CGI applications.
MySQL Tutorial MySQL Interview Questions
Question 8. Is It A Script Or A Program?
The distinction is semantic. Traditionally, compiled executables (binaries) are known as packages, and interpreted packages are commonly known as scripts. In the context of CGI, the difference has emerge as even extra blurred than before. The words are regularly used interchangably (together with on this file). Current usage favours the word "scripts" for CGI packages.
Question nine. What Is The Difference Between Object Oriented And Structured Oriented Programming?
Object Oriented approach programme might be their in phrases of Class and Object dating will be their.
Structured Oriented Means programme might be their in terms of a couple of Functions.
Computer Graphics Interview Questions
$escaped = CGI::get away( $regular );
Sub break out '';
$str =~ s/([^w.-])/sprintf("%%%02X",ord($1))/eg;
$escaped = break out( $regular );
Computer Graphics Tutorial
Question eleven. When Do I Need To Use Cgi?
There are innumerable caveats to this answer, however basically any Webpage containing a shape will require a CGI script or application to process the shape inputs.
IBM WebSphere Administration Interview Questions
Question 12. Is It Possible To Set A Cookie And Then Redirect A Return Visitor To A Different Url All Using Cgi?
#! /usr/bin/perl -w
use CGI qw(:cgi);
my $q = CGI->new();
my $cookie = $q->cookie(
-call => 'yummy_cookie',
-fee => 'chocolate chip',
-domain => '.Wisdomjobs.Com',
-expires => '+10d',
-direction => '/'
-url => 'http://www.Wisdomjobs.Com',
-cookie => $cookie
If you pass over the "-domain", and "-path", then they may default to cutting-edge values. The above instance may be lower back to all servers within the irt.Org domain.
If you miss the "-expires", then the cookie will expire whilst the user closes their browser. The above expires after 10 days.
Perl Scripting Interview Questions
Question thirteen. Can I Redirect Users To Another Page?
For everlasting and simple redirection, use the HTTPD configuration document:
it's far an awful lot extra green than doing it your self. Some servers allow you to do this the use of a report in your own listing (eg Apache) while others use a unmarried configuration record (eg CERN).
For extra complicated instances (eg process shape inputs and conditionally redirect the consumer), use the "Location:" reaction header.
If the redirection is itself a CGI script, it is easy to URLencode parameters to it in a GET request, however dont forget to get away the URL!
Unix makefile Tutorial
Question 14. Does Cgi Create New Security Risks?
There is lots you could do to decrease these.
Question 15. What Is The Difference Between A Cgi Script And A Cgi Program?
Generally, scripts are only numerous lines of code which do a little useful function that might be overkill to write in a complete-featured language. With Perl, you could go both way. You can write Perl scripts and Perl programs. Larry Wall (the creator of Perl) once said "You can write Perl programs, and you could write C scripts. More humans speak approximately Perl applications than C scripts, so I bet which means Perl is extra flexible".
IBM Websphere Application Server Interview Questions
Question 16. How Can I Run My Cgi Program Live In A Debugger?
At First,within the CGI code, at it is start, add "sleep(30);". This will cause the CGI to do nothing for thiry seconds (you may want to adjust this time). Compile the CGI with debuging information ("-g" in gcc) and install the CGI as regular. Next, the use of your web browser, set off the CGI. It will of path simply sit down there doing not anything.
While it's far slumbering, locate it's far PID(ps -a and attach to that PID("connect <pid>" in gdb). You can even need to tell it wherein to find the symbol definitions ("symbol-file <cgi>" in gdb).
Then set a ruin point after the invocation of the sleep characteristic and you're prepared to debug. Do be aware that your browser will finally timeout if it does now not acquire whatever.
Question 17. What Is A Cgi Bin Directory?
A CGI bin directory is a special listing at the server wherein CGI scripts are allowed to be performed.
Most servers are configured to handiest allow CGI scripts to be carried out from one place, so that it will minimize safety holes. Poorly written scripts can wreak havoc on a server if allowed to run unchecked - maximum gadget admins will want to verify that the script isn't always doing whatever malicious before letting you run it.
Nagios Admin Interview Questions
Question 18. Can I Run A Cgi Script Without Returning A New Page To The Browser?
Yes, however think cautiously first: How are your readers going to realize that their "publish" has succeeded? They may additionally hit 'put up' many times!
The correct solution in keeping with the HTTP specification is to return HTTP fame code 204. As an NPH script, this will be:
# do processing (or release it as background task)
echo "HTTP/1.0 204 No Change"
Oracle Interview Questions
Question 19. Why Should I Use Cgi?
Question 20. What Is Difference Between Cgi And Java?
CGI and JAVA are basically distinct, and for maximum applications are NOT interchangable.
CGI is a protocol for strolling programs on a WWW server. Whilst JAVA also can be used for that, and even has a standardised API (the servlet, that is indeed an opportunity to CGI), the primary function of JAVA on the Web is for clientside programming (the applet).
In sure instances the 2 may be blended in a unmarried utility:
for example a JAVA applet to define a vicinity of interest from a geographical map, collectively with a CGI script to method a question for the place described.
Advanced Linux Interview Questions
Question 21. What Is The Difference Between An Interpreted Language And A Compiled Language?
A compiled language is written after which run thru a compiler which checks its syntax and compresses it right into a binary executable. Since an interpreted language isn't compiled, it have to be checked for mistakes at run-time, which makes it pretty a bit slower than a compiled language (like C or Java). Perl is an example of an interpreted language. Remember, although, that simply because a language is interpreted does now not necessarily suggest it isn't complete-featured, or simplistic. Perl can get very complicated and really cryptic, right away.
Question 22. Should I Use Cgi Or An Api?
APIs are proprietary programming interfaces supported via particular systems. By using an API, you lose all portability. If you realize your software will simplest ever run on one platform (OS and HTTPD), and it has a appropriate API, pass in advance and use it. Otherwise stick with CGI.
Question 23. What Is Cgi?
CGI stands for Common Gateway Interface, and is a mechanism thru which a browser is permitted to communicate with programs jogging on a server. If you observe every word in flip it makes extra sense -
Common - something that is available to many humans, regardless of what software program they may be the usage of.
Gateway - a portal via which two matters speak. In this situation, the browser communicates to the server.
Interface - this implies that we're offering a "the front quit" for the application running on the server, that is precisely what it is. You input data in the shape, as an instance, and this is submitted to the program, just like a windows-style program.
Apache Ambari Interview Questions
Question 24. What Is Perl?
Perl is an interpreted language (not compiled, like Java) that's ideally fitted for CGI programming. It has its roots in Unix machine administration and gives numerous functions like everyday expressions and record manipulation which make it extremely effective. It is studying curve has been defined as long and shallow.
It is very smooth to pick up at first, specially in case you are at all acquainted with Unix. However, it does take quite a bit of time to come to be acquainted with all of the little nuances of the language.
MySQL Interview Questions