Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    3

    Default some pl scripts only run with -w

    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. #2
    Member dave9000's Avatar
    Join Date
    Apr 2003
    Location
    arkansas
    Posts
    891
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    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
    Dave Browning
    Intersite Technologies
    Greenbrier Ar
    dave@isitetech.com

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    3

    Default

    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. #4
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    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.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  5. #5
    Registered User
    Join Date
    Mar 2004
    Posts
    3

    Default

    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

Similar Threads & Tags
Similar threads

  1. Users can't run certain scripts
    By shacker23 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 06-12-2008, 08:38 PM
  2. How to run scripts?
    By SXR1337 in forum New User Questions
    Replies: 3
    Last Post: 05-05-2007, 10:13 AM
  3. Can't run cgi scripts
    By hmmblah in forum cPanel and WHM Discussions
    Replies: 9
    Last Post: 12-11-2005, 10:42 PM
  4. Need to run own scripts as root
    By metal_cd in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 10-03-2005, 02:18 AM
  5. if we run scripts fixqoutas
    By nashirnet in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 06-29-2004, 09:08 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube