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.

perl scripts wont run

Discussion in 'General Discussion' started by EMS, Sep 13, 2003.

  1. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    I just created a new domain and uploaded a basic perl script to the cgi-bin.

    When I ran the script the server came up with 500 internal server error. (yes I did upload the script in ascii and chmod to 755 - its just a basic script and theres nothing wrong with it).

    I uploaded another really simple script which brings up server info - it works on other domains on the same server but I'm still getting 500 errors when trying to run anything from the cgi-bin of this domain.

    Any ideas ? is there anything in /scripts that might be a quick fix ?

    This hasnt happened before - just a routine account set up. I've terminated the account and re-created it - still same problem.

    The error log says Premature end of script headers:

    The script is just this... (to prove the script is not at fault)


    cPanel.net Support Ticket Number: help
     
    #1 EMS, Sep 13, 2003
    Last edited: Sep 13, 2003
  2. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    Put this before your code:

    BEGIN {
    $| = 1;
    open(STDERR, ">&STDOUT");
    print "Content-type: text/plain\n\nScript Error\n";
    }


    I can see where the syntax error is in your coding, but using the above error printout code is a good debugging method to get used to. Remove it when script works correctly.

    cPanel.net Support Ticket Number:
     
  3. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    There is no error in the script.

    I have uploaded it to other domains on the same server - today - and it works fine. I have also uploaded and run several other scripts that are currently working on other domains - in this cgi-bin and yet the error still occurs.

    Also - I have just rebuilt apache - still the error is there when running any perl script from this domain.

    Also - I have looked at other posts on this forum and seen a few people with similar problems, tried some of the suggestions in those posts and the error still occurs.


    cPanel.net Support Ticket Number:
     
    #3 EMS, Sep 13, 2003
    Last edited: Sep 13, 2003
  4. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    And the output of using the error code I mentioned above is ...

    cPanel.net Support Ticket Number:
     
  5. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    I have tried your code and a more complicated version of it also.

    Still a 500 error.

    cPanel.net Support Ticket Number:
     
  6. Website Rob

    Website Rob Well-Known Member

    Joined:
    Mar 23, 2002
    Messages:
    1,506
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    Alberta, Canada
    cPanel Access Level:
    Root Administrator
    Ok, my mistake - missed seeing a closing parenthesis. :eek:

    Ran your code myself and got no errors. As the error code I posted should provide output of any script errors, if it is still only producing a 500 error, we know the problem is with the Server setup.

    Presuming file ownershop is also correct, try adding 1; to the end of the script.

    I have had similar problems to this in the past and found I had to create a directory (within cgi-bin) to put the script in -- in order for it to work. Never did figure out what the problem was, but seemed to be related to Cpanel.

    Sometimes an update would cause scripts -- that were previously working just fine -- to break. Then, an update or two later they would start working again -- with no other changes made.

    No saying that is the problem here, just mentioing my past experience with similar script problems.

    cPanel.net Support Ticket Number:
     
  7. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    I have seen similar threads on this forum with the same issues.

    There should be no reason why a newly created account just wont run scripts - but that is definateley the case here.

    Must be a very strange bug to cause something like that.

    I have seen a couple of posts where after adding -w to the perl path, the scripts work - tried that, doesnt work for me.

    Also just added another folder to the cgi-bin and tried running the script from there - no luck.

    I'd like to know what cpanel have to say about this, mainly because its an interesting problem.

    Anyone have any more ideas ?

    cPanel.net Support Ticket Number:
     
  8. scottc

    scottc Well-Known Member

    Joined:
    Apr 21, 2002
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    EMS - did you ever find a solution for this? I have the same problem. I can move a working Perl script from one domain to another and it will not work from a browser. It will work from shell. Permissions and ownership are correct. Putting it in cgi-bin or a subdirectory of cgi-bin doesn't help. The other suggestions in this thread doesn't fix it either.

    Thanks.

    Scott

    cPanel.net Support Ticket Number:
     
  9. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    Any possibility the account was created with the "Cgi Access" box unchecked?

    It's the first thing that came to my mind.

    cPanel.net Support Ticket Number:
     
  10. EMS

    EMS BANNED

    Joined:
    May 10, 2003
    Messages:
    250
    Likes Received:
    0
    Trophy Points:
    0
    When I had the problem originally, I removed and recreated the account several times. After the 3rd or 4th attempt it was ok.

    cPanel.net Support Ticket Number:
     
  11. gordita

    gordita Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Perhaps this is related to the error I recieve when I try to access domain.com/controlpanel? http://forums.cpanel.net/showthread.php?s=&threadid=15952

    The /usr/local/cpanel/base/redirect.cgi script is Perl and owned by root... is everyone else's owned by root.root as well?

    cPanel.net Support Ticket Number:
     
  12. vwolsink

    vwolsink Registered

    Joined:
    Oct 26, 2003
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I have the same problem. And i'm really getting irritated about it. The cgi scripts just won't run. I checked everything :(
     
  13. gordita

    gordita Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    SuExec

    I had to disable SuExec to get this fixed... it's a shame, but whenever I turn it on it will no longer run cgi scripts... not even the /usr/local/cpanel/base/redirect.cgi script that is essenential to the operation of cpanel.

    I've contact cPanel support about this, but unfortunately they have not been able to fix it as of yet. They recomipled apache for me and then told me they'd escalate it to their developers to research... that was over a week ago... no word back yet.
     
  14. rsaylor

    rsaylor Well-Known Member

    Joined:
    Mar 27, 2003
    Messages:
    160
    Likes Received:
    1
    Trophy Points:
    18
    I ran your original script it it works fine on my server.

    cPanel 8x
    Redhat 7.3

    Make sure your user is the correct owner.

    chown user.user perlfile.cgi

    I placed the perl file in the www but it should work in the CGI also.
     
  15. vwolsink

    vwolsink Registered

    Joined:
    Oct 26, 2003
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Re: SuExec

    Doesn't work for me either :(
     
  16. Curt

    Curt Well-Known Member

    Joined:
    Oct 16, 2001
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    6
    The only way I could get perl to work again was to change the update from stable to release then fromn shell run /upcp (this did not fix the issue) then change the update preference back to stable then run /upcp again and perl started working.
     
  17. gordita

    gordita Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    It's working for me now with:
    Apache 1.3.29
    WHM 8.5.4 cPanel 8.5.4-R7
    RedHat 7.2 - WHM X v2.1.1
     
Loading...

Share This Page