#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    4
    Rep Power
    0

    PERL Permission error


    I've been trying to figure this out for two days, and I'm at a complete loss....

    I'm brand new to perl, and I'm just trying to get a very basic "hello world" script to run.

    the file itself is in /var/www/html.
    file name: test.pl

    I've set the permission on EVERYTHING to 777, (just to try and get this working....)

    The script is owned by the ftp user

    it works via prompt:
    #perl /var/www/html/test.pl
    (Prints out "hello World")

    Code:
    #!/usr/bin/perl 
    use strict; 
    use warnings; 
    print "content-type: text/html \n\n";  
    print "Hello, Perl!";
    This is hosted on an aws ec2 instance, and for some reason it won't let me access the error log as "ec2-user", it says I don't have permissions to httpd directory in "/var/log", so I can't check the error logs.

    Also, cant access them from /etc/httpd/logs

    Here's link to my httpd.conf file on the ec2 server (in it's entirety..sorry):

    http://ec2-54-235-17-121.compute-1.amazonaws.com/httpdconf.txt

    http://ec2-54-235-17-121.compute-1.amazonaws.com/test.pl

    Any help would be greatly appreciated.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,938
    Rep Power
    1225
    Move the script to your cgi-bin directory.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    4
    Rep Power
    0
    Originally Posted by FishMonger
    Move the script to your cgi-bin directory.
    It's already in there
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,938
    Rep Power
    1225
    Add the CGI::Carp module to see the error log entries that the script generates.

    Code:
    #!/usr/bin/perl
    
    use strict;
    use warnings;
    use CGI::Carp qw(fatalsToBrowser);
    
    print "content-type: text/html \n\n";
    print "Hello, Perl!";
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,938
    Rep Power
    1225
    Originally Posted by newbie_perlie
    It's already in there
    According to your opening post it's in /var/www/html

    If it's in your cgi-bin dir, then you need to use the correct url

    http://ec2-54-235-17-121.compute-1.amazonaws.com/cgi-bin/test.pl
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    4
    Rep Power
    0
    Originally Posted by FishMonger
    Add the CGI::Carp module to see the error log entries that the script generates.

    Code:
    #!/usr/bin/perl
    
    use strict;
    use warnings;
    use CGI::Carp qw(fatalsToBrowser);
    
    print "content-type: text/html \n\n";
    print "Hello, Perl!";
    And run it again from the command line?
    Prints out:
    Code:
    content-type: text/html
    
    Hello, Perl!
    running it in a browser does nothing but that permissions error again
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,938
    Rep Power
    1225
    I just noticed a problem in your conf file.

    ScriptAlias /cgi-bin/ "/var/www/html/"

    should be
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

    and that's where the script should be placed.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    4
    Rep Power
    0
    Originally Posted by FishMonger
    I just noticed a problem in your conf file.

    ScriptAlias /cgi-bin/ "/var/www/html/"

    should be
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

    and that's where the script should be placed.
    Ok I changed that, but still the permission error.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,938
    Rep Power
    1225
    Was apache restarted after making the change in the conf file? That will need to be done to enable the change.

    If it still doesn't work, then it would appear that your host may have something configured incorrectly. You may need to contact their tech support.

IMN logo majestic logo threadwatch logo seochat tools logo