Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Member
    Join Date
    Apr 2004
    Posts
    6

    Default Problems with executing perl-scripts

    I have a problem executing Perl-scripts which I have uploaded via FTP.

    I always get a "500 Internal Server Error" while trying to run them.

    they are chmodded correctly and the sourcecode's fine.
    but it still doesn't let me execute them.

    What's wrong?

  2. #2
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    There are 2 things I do to debug scripts.

    1 - Add the following line to the script, anywhere after the first line and before the actual script functions:
    use CGI::Carp qw(fatalsToBrowser);
    This will make the browser tell you the error.

    2 - If your account includes shell access, in shell do the following, replacing username with your account username and scriptname with the scripts file name:
    perl -c /home/username/public_html/cgi-bin/scriptname.cgi
    This tests the script and tells you if there is a problem.
    You may need to adjust the line to the actual path to the script.
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

  3. #3
    Member
    Join Date
    Apr 2004
    Posts
    6

    Default

    it does uses the "Fatalstobrowser" line and it has "print "Content-type: text/html\n\n";

    about shell, I do not have ability to use it.

    but there's no script problem cuz I got perl installed on my computer and there's no error there..

    however if I create the script using Cpanel's file manager.. the scripts works fine.. but not when uploading thru ftp..

    I must edit and create scripts online.. but I prefer using ftp as it will go a bit faster and I don't have to be signed in to the panel all the time when editting

  4. #4
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    That sounds like your ftp program is uploading the script in binary. Scripts have to be uploaded in ascii format.
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

  5. #5
    Member
    Join Date
    Apr 2004
    Posts
    6

    Default

    LOL

    That was the problem :P

    On another server the Binary/ASCII didn't matter.. but here it did..

    Thanks squirrel

  6. #6
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    That would have been a windows server. That's one of the many differences between windows and unix/linux.
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

  7. #7
    Member
    Join Date
    Apr 2004
    Posts
    6

    Default

    Actually the operative system was linux.

  8. #8
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    That's weird. I've been using cgi for 5 years now and always linux and always had to be ascii. Oh well. Probably another mystery never to be solved.
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

  9. #9
    Registered User
    Join Date
    Jun 2004
    Posts
    4

    Default

    The man with the problem is actually trying to help me, with this being my problem, I uploaded it in ascii formatt. cuteftp automatically does that and .pl is addded to the auto ascii uploading list. SO that's not the problem.

    Originally posted by squirrel
    That sounds like your ftp program is uploading the script in binary. Scripts have to be uploaded in ascii format.

  10. #10
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    Did you try these 2 things?

    Originally posted by squirrel
    There are 2 things I do to debug scripts.

    1 - Add the following line to the script, anywhere after the first line and before the actual script functions:
    use CGI::Carp qw(fatalsToBrowser);
    This will make the browser tell you the error.

    2 - If your account includes shell access, in shell do the following, replacing username with your account username and scriptname with the scripts file name:
    perl -c /home/username/public_html/cgi-bin/scriptname.cgi
    This tests the script and tells you if there is a problem.
    You may need to adjust the line to the actual path to the script.
    Do your cpanel error logs show anything?
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

  11. #11
    Registered User
    Join Date
    Jun 2004
    Posts
    4

    Default

    The perl script was already in my profile. But I haven't tryed the shell script, being I don't see it under the control panel, and don't think I have that option. But now what it is doing is trying to say that the perl script can't find a fiel in a directory that I know is there, I have actually looked and checked to make sure it's there, and it says it can't find it. I'm to the point of giving up. lol


    Originally posted by squirrel
    Did you try these 2 things?



    Do your cpanel error logs show anything?

  12. #12
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    Is the file in the same place the script thinks it's in?
    Is the file readable/writeable by the script? The file permissions would usually be 660 or 666.
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

  13. #13
    Member dave9000's Avatar
    Join Date
    Apr 2003
    Location
    arkansas
    Posts
    891
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    If you can get shell access do a vi -b <scriptname> and see if you have ^m dos carriage returns at the EOL

    this will cause script errors on unix/linux

    there is a string substition in vi to change this to null but i right off hand don't remember it

    you can also use dos2unix converter to modify it

Similar Threads & Tags
Similar threads

  1. Perl errors while executing scripts
    By mystikzen in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-30-2006, 09:00 AM
  2. Replies: 11
    Last Post: 02-15-2004, 12:11 PM
  3. Addon scripts and MAJOR perl problems
    By jrehmer in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 10-02-2003, 12:20 PM
  4. Executing a Perl script
    By oinkmedia in forum Themes and Branding
    Replies: 0
    Last Post: 07-20-2003, 06:07 PM
  5. rsync problems while executing /scripts/upcp
    By anand in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-21-2002, 07:42 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube