Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default malformed header

    Hi,

    I'm trying my first perl script on a Unix server, but without any success!

    The script (codice.pl) is something like this:

    #!/usr/bin/perl
    $home="/home/dominio/public_html";
    print "Home $home";

    when I run it, I get this error:

    malformed header from script. Bad header=Home /home/dominio/public_:
    /home/dominio/public_html/cgi-bin/codice.pl

    Can someone help me to understand where I'm wrong?

    Thanks very much,
    Nino

    =================================
    [url]http://www.vessella.it[/url] (italiano, esperanto, kiswahili, english)
    [url]http://www.changamano.org[/url] (Iniziative di solidarietà per la Tanzania)
    Corso di lingua swahili: [url]http://corsoswahili.vessella.net[/url]
    Corso di lingua esperanto: [url]http://esperanto.vessella.net[/url]
    Jifunze lugha ya Kiesperanto: [url]http://kiesperanto.vessella.net[/url]
    Kamusi/Vortaro: [url]http://kamusi.vessella.net[/url]
    Vocabolario esperanto-italiano: [url]http://vortaro.vessella.net[/url]
    Articoli di quotidiani della Tanzania: [url]http://habari.lernado.it[/url]

    Nino V Guest

  2. Similar Questions and Discussions

    1. Malformed URL trying to place multimedia content
      I create a blank ID document, and then try to place an swf file and get the error message "Download failed due to malformed URL". The same thing...
    2. Can't Update to 7.01 - malformed server response
      I am trying to update the CF from 7.0.0 to the "ColdFusion MX 7 Updater (7.0.1) ". I go to CF Admin "System Information " and in Update File, I...
    3. HTTPService Fault: An XML element was malformed
      I'm new to Flex and encountered this error. I have a datagrid that gets populated from an HTTP Service call.I traced it to find that it occurs only...
    4. Malformed Header from Script error (Error 500)
      Hi! If i tried to view a php page that is located on my webserver, apache shows the error #500 and the error_log says: malformed header from...
    5. malformed url
      I am sending email from apache using mail(). In the email I am sending a url. The url is rather long and consequently the email client is adding...
  3. #2

    Default RE: malformed header

    The short answer...

    Make sure this is the first print statement:

    print "Content-type: text/html\n\n";


    The long answer...

    CGI scripts work by passing the web server a header part and a body part.
    The header part must contain AT LEAST the content type of the document (e.g.
    "text/plain", "text/html", etc). The header is then followed by a single
    blank line, then comes the main body content for the page.

    The web server takes your header info and adds some of it's own (or even
    modifies yours). It them sends this page to the client (browser) in two
    parts... header, followed by a blank line, then the body content (see HTTP
    specs).

    The print statement I game above includes the minimal header info, the
    Content-type, as well as a single blank line. Anything after that statement
    is taken by the web server as belonging to the body.

    The error you recieved was because you never printed the header, only the
    body, and the web server choked on it because it didn't make any sense (was
    malformed).

    Hope the helps.

    Rob

    -----Original Message-----
    From: Nino V [mailto:nino@vessella.it]
    Sent: Monday, October 13, 2003 1:49 PM
    To: [email]beginners@perl.org[/email]
    Subject: malformed header


    Hi,

    I'm trying my first perl script on a Unix server, but without any success!

    The script (codice.pl) is something like this:

    #!/usr/bin/perl
    $home="/home/dominio/public_html";
    print "Home $home";

    when I run it, I get this error:

    malformed header from script. Bad header=Home /home/dominio/public_:
    /home/dominio/public_html/cgi-bin/codice.pl

    Can someone help me to understand where I'm wrong?

    Thanks very much,
    Nino

    =================================
    [url]http://www.vessella.it[/url] (italiano, esperanto, kiswahili, english)
    [url]http://www.changamano.org[/url] (Iniziative di solidarietà per la Tanzania)
    Corso di lingua swahili: [url]http://corsoswahili.vessella.net[/url]
    Corso di lingua esperanto: [url]http://esperanto.vessella.net[/url]
    Jifunze lugha ya Kiesperanto: [url]http://kiesperanto.vessella.net[/url]
    Kamusi/Vortaro: [url]http://kamusi.vessella.net[/url]
    Vocabolario esperanto-italiano: [url]http://vortaro.vessella.net[/url]
    Articoli di quotidiani della Tanzania: [url]http://habari.lernado.it[/url]


    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]
    Rob Hanson Guest

  4. #3

    Default R: malformed header

    Hi, Rob!

    You were right!

    Thanks to you I've fixed the script.

    Thanks a lot.

    Ciao,
    Nino

    =================================
    [url]http://www.vessella.it[/url] (italiano, esperanto, kiswahili, english)
    [url]http://www.changamano.org[/url] (Iniziative di solidarietà per la Tanzania)
    Corso di lingua swahili: [url]http://corsoswahili.vessella.net[/url]
    Corso di lingua esperanto: [url]http://esperanto.vessella.net[/url]
    Jifunze lugha ya Kiesperanto: [url]http://kiesperanto.vessella.net[/url]
    Kamusi/Vortaro: [url]http://kamusi.vessella.net[/url]
    Vocabolario esperanto-italiano: [url]http://vortaro.vessella.net[/url]
    Articoli di quotidiani della Tanzania: [url]http://habari.lernado.it[/url]

    Nino V Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139