The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

some pl scripts only run with -w

Discussion in 'General Discussion' started by bernieberg, Apr 9, 2006.

  1. bernieberg

    bernieberg Registered

    Joined:
    Mar 18, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Howdy, for some reason some perl cgi scripts will only run with the -w option. If the -w option is not there then i get an "internal server error" and the apache error log logs "Premature end of script headers", or some such. Here are the scripts I am using to test this, in the same exact cgi-bin with the same owner/group and same permissions, but only the one with -w will work

    This one does not work:
    #!/usr/bin/perl
    print "Content-type: text/plain\n\n";
    print "hello world\n";

    This one works!
    #!/usr/bin/perl -w
    print "Content-type: text/plain\n\n";
    print "hello world\n";


    Any Ideas?
    Thanks!
    --
    bernie
     
  2. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    the -w changes the error/warning reported by perl

    I would suggest running both versions via command line in ssh and see if they run clean or what errors are returned.

    as in

    /path to file/filename.cgi

    also make sure the permissions are no higher than 0755 on the file and if running suexec 0711 and owned by username:username of the web site your running it in
     
  3. bernieberg

    bernieberg Registered

    Joined:
    Mar 18, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Dave,

    Thanks for the reply. The permissions are 755 and the owner/group is the correct user. When I run from command line they both run correctly, it seems that I am only having this issue in apache. That is what confuses me, if there was an error (or warning) I would hope that the -w would give me some helpful information, but all it does is make it run.

    I suspect apache, but im not sure what to look for. This happens in all my accounts, and in cgi-sys. I have recompiled apache (from WHM) a number of times with different options and nothing has changed.

    thanks,
    --
    bernie
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Actually, from my many years in the past as a perl CGI developer it's most likely that the perl scripts are being uploaded in BINARY instead of ASCII mode. Double check that they are definitely being uploaded in ASCII mode and they ought to work without the -w then. If you're uploading using a Mac then you need to make doubley sureas they have a nasty habit of leaving Mac linefeeds instead of unix ones.
     
  5. bernieberg

    bernieberg Registered

    Joined:
    Mar 18, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Jonathan,

    Of course, you are right. I had read this durring my troubleshooting, but had discounted it becuase the way I created the scripts was to cut and paste them into vi inside of putty. This must have created the same problems uploading them in binary does.

    thanks for your help,
    --
    bernie
     
Loading...

Share This Page