TechMynd, Fresh Downloads and Latest Technology News, Stuff That Works | Downloads, Tips & Tricks, Softwares, Programming, Resources, IT, Computer, Resources, Freewares

Basics of CGI



Some basics of CGI which you must know before writing your first CGI code.

  1. Always Remember CHMOD that is the file permissions. Set it using your favorite ftp software. CGI script file it must be 755 and at folder which contains CGI scripts also 755 but for the folder which stores data it must be 777.
  2. Cgi pages use cgi-bin directory.
  3. The first line of many CGI scripts is: #!/usr/local/bin/perl or #!usr/bin/perl (if the script is written in Perl).
    #!/usr/bin/perl -wt
    or simply
    #!/usr/bin/perl
  4. Path to sendmail is
    /usr/sbin/sendmail
    Use it while sending mails like this in a variable
    my $sendmail = “/usr/sbin/sendmail”;
    Path to perl
    /usr/bin/perl
  5. When error occurs Cgi won’t guide you about exact error. You will have to see the error log in your hosting account.
    CHMOD for cgi pages.. Must be 755.
    Scripts pages permissions must be executable.
  6. 500 error occurs in cases of *File execution wrong permissions *First wrong interpreter line *Syntax error *Missing required file *Invalid HTTP headers sent as referred in point 5. *Wrong version of perl *Server configuration error
  7. The first output sent by a script must always be a valid HTTP header, i.e.
    Content-type: text/html or Content-type: text/plain\n\n
    The header must always be followed by two linefeeds.

Some Useful resources Links

http://www.cgi101.com/book/ch1/text.html
http://www.usersonline.net/onlinecount.shtml
http://www.tele-pro.co.uk/scripts/contact_form/contact_form.asp
http://simplythebest.net/scripts/perl_scripts/

Share/Save/Bookmark

Tags:
Posted in: CGI
Post's RSS » RSS 2.0
Post's Comments RSS » RSS 2.0

Related Posts


Post a Comment

Comment will appear here after approval, Thanks for patience

  Subscribe Via RSS
  Subscribe Via Email

Add to Technorati Favorites

About
Techmynd is created by Hiroshi, an IT enthusiast from Pakistan.

I love blogging, software development & social networking.

Ask me for solution relating to blogging, softwares, troubleshooting and get free advice/recommendation. I answer every email except spam.

Get Website Updates via Email:
more »






English flagItalian flagKorean flagChinese (Simplified) flagPortuguese flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroat flagDanish flagFinnish flagHindi flagPolish flagRumanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flag