CGI issue (SUExec as well maybe)

Discussion in 'Installation/Configuration' started by MathieuMa, Mar 23, 2006.

  1. MathieuMa

    MathieuMa New Member


    I'm running ISPConfig 2.2 on a Debian Sarge perfect setup.
    I'm trying to get CGI to work on a site but for now, after trying many things, I didn't manage.

    In addition to checking "Enable CGI" for that host, here are the relevant additional configurations I added (they should be redundant, but well) :
    ScriptAlias /calendar/ /var/www/web3/web/calendar/
    <Directory /var/www/web3/web/calendar>
    	Options +ExecCGI +FollowSymLinks
    For my tests I'm trying to run a simple perl cgi which sends the html doctype and prints a nice hello world - it works locally.
    The permissions are as follow :
    -rwxr-xr-x   1 web3_xxx web3     78 Mar 23 10:45 test.cgi
    The error log shows the following when hitting the CGI :
    [error] (13)Permission denied: exec of '/var/www/web3/web/calendar/test.cgi' failed
    [error] Premature end of script headers: test.cgi
    I then decided to enable suexec, and here are the errors I get :
    [error] Premature end of script headers: test.cgi
    [error] failed to open log file
    [error] fopen: Permission denied
    The corresponding suexec log :
    uid: (10008/web3_xxx) gid: (10003/10003) cmd: test.cgi
    I also tested with falko's in case, in the cgi-bin directory and in my calendar directory -> no go ...

    Thanks in advance for any hint which could help :)
    Last edited: Mar 23, 2006
  2. falko

    falko Super Moderator Howtoforge Staff

    You must put all Perl scripts into the cgi-bin directory, and you must make them executable.
    If you edited the scripts on a Windows PC before, you must save them with Unix linebreaks, not Windows linebreaks.
  3. MathieuMa

    MathieuMa New Member

    Putting the script in cgi-bin gave me the same result - but the additional directive I added should make them fine in the calendar directory.
    Oh, and the script was executable : -rwxr-xr-x

    I used vi on the server to edit my test - and unzipped your tests file directly on the server.
  4. MathieuMa

    MathieuMa New Member

    Did another test to be sure, placed my cgi in the cgi-bin directory.

    suexec log tells me :
    [2006-03-23 18:50:37]: uid: (10008/web3_claudem) gid: (10003/10003) cmd: test.cgi
    Error log tells me :
    [Thu Mar 23 18:51:25 2006] [error] [client xxx] failed to open log file
    [Thu Mar 23 18:51:25 2006] [error] [client xxx] fopen: Permission denied
    [Thu Mar 23 18:51:25 2006] [error] [client xxx] Premature end of script headers: test.cgi
    Permissions are as follow :
    web3_claudem@ns33446:/var/www/web3/cgi-bin$ ll
    total 12
    drwxr-xr-x   2 web3_claudem web3 4096 Mar 23 11:12 .
    drwxr-xr-x  12 web3_claudem web3 4096 Mar 23 10:48 ..
    -r--------   1 root         root    0 Feb 11 13:10 .no_delete
    -rwxr-xr-x   1 web3_claudem web3   78 Mar 23 10:47 test.cgi
    And I didn't changed the config :)

    Test.cgi is as follow, written using vi in a term :
    print "Content-type:text/html\n\n";
    print "Hello World!!!";
  5. MathieuMa

    MathieuMa New Member

    Found my issue - the /var/www partition had the noexec option (I'm used to do that as I never used cgi before) :)

Share This Page