+ Reply to Thread
Results 1 to 5 of 5

Thread: Perl?

  1. #1
    pzelnip is offline x10Hosting Member pzelnip is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    2

    Perl?

    Okay, how do you get Perl working on here? I've uploaded about the simplest Perl script I can create, threw it into my cgi-bin directory, and changed the permissions to 755.

    I still get 500 Internal Server Error.

    My code is:

    #!/usr/bin/perl
    use CGI;
    use CGI::Carp qw(fatalsToBrowser);

    # create a new CGI object to handle this request
    $q = new CGI;

    # display standard HTML header stuff

    print $q->header,
    $q->start_html('Echo CGI'),
    $q->h1('Echo CGI');

    # get a list of all parameters (fields) passed to us
    @names = $q->param;

    # now display a DL with params and values
    print "<HR>";
    print "<DL>";

    # loop over all the param names (sorted)
    # displaying each name and associated value
    foreach $n (sort @names) {
    print "<DT><B>$n</B>";
    print "<DD>", $q->param("$n");
    }

    print "</DL>";
    print "<HR>";

    # the HTML trailers
    print $q->end_html;

    # end

    Which should be able to be run at:

    http://pzelnip.x10hosting.com/cgi-bin/echo.cgi?test=20
    Last edited by pzelnip; 05-27-2009 at 09:59 PM.

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Perl?

    Your script works for me on Absolut. Perhaps there's something wrong with the server configuration, either host-wide or something in your root .htaccess. What are the permissions for cgi-bin? Is there anything in your error log?

    Try something even simpler:
    Code:
    #!/usr/bin/env perl
    print "Content-type: text/plain\n\n"
    print "Success?\n"

  3. #3
    pzelnip is offline x10Hosting Member pzelnip is an unknown quantity at this point
    Join Date
    May 2009
    Posts
    2

    Re: Perl?

    Quote Originally Posted by misson View Post
    Your script works for me on Absolut. Perhaps there's something wrong with the server configuration, either host-wide or something in your root .htaccess. What are the permissions for cgi-bin? Is there anything in your error log?
    Okay now the echo script works. Apparently when I changed the permissions they didn't stick as somehow they were reset to 644.

    Now my problem is the other script which is in my cgi-bin directory isn't working.

    Looking at the raw error logs, I see:

    [28/May/2009:18:33:36 -0500] "POST /cgi-bin/mail_form.cgi HTTP/1.1" 404 - "http://pzelnip.x10hosting.com/feedback.html" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10"

    Why there would be a 404 error is beyond me though. The feedback.html file comes up fine, but the script it calls upon isn't working (and I know the script is valid as I have it hosted elsewhere and it works fine).

    Edit: and your script had the same problem. Uploaded it, gave it 755 for permissions, and same error.
    Last edited by pzelnip; 05-28-2009 at 06:50 PM.

  4. #4
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: Perl?

    how can a regular static html file can call some server side cgi?
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  5. #5
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Perl?

    Quote Originally Posted by pzelnip View Post
    Okay now the echo script works. Apparently when I changed the permissions they didn't stick as somehow they were reset to 644.
    FTP clients may change the permissions of an uploaded file to match the local version, even if the local filesystem doesn't use Unix style permissions.

    Quote Originally Posted by pzelnip View Post
    Now my problem is the other script which is in my cgi-bin directory isn't working.

    Looking at the raw error logs, I see:

    [28/May/2009:18:33:36 -0500] "POST /cgi-bin/mail_form.cgi HTTP/1.1" 404 - "http://pzelnip.x10hosting.com/feedback.html" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10"

    Why there would be a 404 error is beyond me though.
    Considering the error page resulting from mail_form.cgi says "Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request", the 404 error in the log is probably because there's an error document directive (either in the virtual host configuration or the root .htaccess) that refers to a nonexistent file. Something like:
    Code:
    ErrorDocument 500 /500.html
    The 404 is harmless. If it really bugs you, you can always create a custom error page.

    Quote Originally Posted by pzelnip View Post
    The feedback.html file comes up fine, but the script it calls upon isn't working (and I know the script is valid as I have it hosted elsewhere and it works fine).

    Edit: and your script had the same problem. Uploaded it, gave it 755 for permissions, and same error.
    Hmmm.... Does mail_form.cgi send fatal errors to the browser? If something like the following produces a 500 error, you know the script isn't even being executed.

    Code:
    #!/usr/bin/perl
    use CGI;
    use CGI::Carp qw(fatalsToBrowser);
    
    print CGI::header(-type => 'text/html');
    
    print "Success?"
    Also, make sure your browser isn't loading the cached error page.

+ Reply to Thread

Similar Threads

  1. PERL development setup - beginner
    By gophercg in forum Programming Help
    Replies: 4
    Last Post: 05-20-2009, 01:00 PM
  2. Perl version on free host?
    By jdw999 in forum Programming Help
    Replies: 12
    Last Post: 04-06-2009, 08:40 PM
  3. Some very usfull links for php & perl.
    By DefecTalisman in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 12-11-2008, 07:49 PM
  4. Internal Server Error FOR Perl script
    By radofeya in forum Free Hosting
    Replies: 0
    Last Post: 04-14-2008, 01:06 PM
  5. To all those using Perl and CGI
    By DefecTalisman in forum Free Hosting
    Replies: 0
    Last Post: 09-16-2007, 03:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers