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.

CGI Scripts outside cgi-bin

Discussion in 'General Discussion' started by compunet2, Jun 11, 2004.

  1. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    Since I upgraded cpanel & apache, I haven't been able to run cgi scripts outside of the cgi-bin directory. Is there some way to fix this?
     
  2. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    If you using Suexec enabled, any Perl scripts must be in a folder that is chmoded 0755. The cgi-bin, by default is set to 0755, the same applies to any other folder where you maybe using your scripts,... otherwise you'll get errors. Plus the script(s) must be chmoded the same.

    Mickalo
     
  3. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    Nope.. I tried that and no luck. I have the script in public_html, and I tried to chmod it to 755, as well as the script, but it still doesn't run. Suexec is enabled. I can run the script in cgi-bin, and I can also create another folder, chmod the folder to 755, and it runs there too, just not in public_html... I get 500 Internal Server Error. Thanks.
     
  4. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    what is the /public_html folder set too ?? it should be set too 0750 and owned by the "username" and group by "nobody"

    Mickalo
     
  5. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    It is, but if I chmod public_html to 755, I still get the error.
     
  6. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    what is in the apache error_log and suexec_log... what sort of error for that script ??

    Mickalo
     
  7. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    SUEXEC:
    [2004-06-11 15:56:51]: info: (target/actual) uid: (test4/test4) gid: (test4/test4) cmd: serverinfo.cgi
    [2004-06-11 15:56:51]: error: target uid/gid (32003/504) mismatch with directory (32003/99) or program (32003/504) or trusted user (0/10)

    -----
    APACHE_LOG:

    [Fri Jun 11 14:35:59 2004] [error] [client 24.228.58.228] Premature end of script headers: /home2/test4/public_html/serverinfo.cgi


    I can copy this script to any folder, and it works fine (no modification needed... its just a server info script). No other scripts will work in the public_html folder either.

    I'm running cPanel 9.4.0-R21
     
    #7 compunet2, Jun 11, 2004
    Last edited: Jun 11, 2004
  8. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    possibly something in the /public_html/.htaccess file that maybe causing a conflict ?? Or you may have something mis-configured in your httpd.conf file :confused:

    Mickalo
     
  9. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    This problem is server wide, effecting 2 servers I upgraded. Is anyone else running cPanel 9.4.0-R21, and running cgi scripts in the public_html folder?
     
  10. mickalo

    mickalo Well-Known Member

    Joined:
    Apr 16, 2002
    Messages:
    765
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    N.W. Iowa
    One of the servers I manage, is a RH 9.0 w/cPanel 9.4.0-R21 and we have no problems executing Perl scripts within the /public_html folder

    so you may want to check your httpd.conf file to make sure there isn't some problem there.

    Mickalo
     
  11. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    The problem is odd. I just tried on our test server and was able to upload and browse to a CGI script in the /public_html directory of a site - this is with suexec enabled.

    This server is currently running 9.4.0-E19

    I just did a further test and switched off suexec and the script now errors. Is it possible that you forgot or accidentally didn't compile suexec into the new Apache version when yo recompiled it? Maybe recompiling Apache would be a good idea.
     
  12. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    Suexec is showing enabled (its also generating an error in the log from this script (shown above)). I tried to rebuild easyapache (and double checked, suexec is installed), then reboot, but no luck. I looked at the httpd.conf file, but I dont see anything that looks different from before, or unusual.
     
  13. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    I think it might have something to do with the group being 99 (nobody), and suexec not allowing the script to run in a folder that is owned by 99. However this is a normal group for public_html in cPanel, and has always worked fine before.
     
  14. goyo

    goyo Member

    Joined:
    Jun 17, 2003
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Same problem here :(

    This server is currently running 9.4.0-E19

    Problem appeared after the security update.

    Used same apacheupdate options as before. Can't find any difference in httpd.conf
     
  15. compunet2

    compunet2 Well-Known Member

    Joined:
    Feb 21, 2003
    Messages:
    310
    Likes Received:
    0
    Trophy Points:
    16
    Found the solution... rebuild apache with webroot protection enabled.
     
Loading...

Share This Page