cPanel randhtml.cgi not working with LSWS SSI

Discussion in 'Bug Reports' started by ffeingol, Sep 7, 2010.

  1. ffeingol

    ffeingol Member

    We have clients using the cPanel randhtml.cgi script to display random 'sayings' on their web site via SSI. It works when it's running through Apache but you get no output when the SSI is handled by LSWS.

    Please let me know if you need any other information.
  2. mistwang

    mistwang LiteSpeed Staff

    can you please give some sample code that we could try in our lab?
  3. ffeingol

    ffeingol Member

    1) Ensure that "Random Html Generator" is enabled in default features (or any set of features that you use)
    2) Create a cPanel account
    3) Log into that cPanel account
    4) Click on 'CGI Center'
    5) Click on 'Random HTML Generator'
    6) Enter some text
    7) create a .shtml page with the code they give you:

    Code:
    <!--#include virtual="cgi-bin/randhtml.cgi"--> 
    
  4. NiteWave

    NiteWave Administrator

    I created a page test.shtml
    ("cgi-bin/randhtml.cgi" should follow user's account name)

    in apache, the result:
    in lsws, result is
    "ERROR 404: Not Found"

    although the result different, both not working.

    can you further confirm it's working under apache?
  5. ffeingol

    ffeingol Member

    What version of cPanel/WHM are you running? The sample code I gave (and what our client is running) does not have the user-id at the end of the code (see my example). The code works. With Apache the get random quotes (that's what they put in for the text) and under LSWS it's just blank.
  6. NiteWave

    NiteWave Administrator

    WHM 11.26.8

    this is probably the original randhtml.cgi
    Code:
    ~>ls -l /usr/local/cpanel/cgi-sys/randhtml.cgi
    -rwxr-xr-x 1 root wheel 352408 Sep  8 04:51 /usr/local/cpanel/cgi-sys/randhtml.cgi*
    
    is it same as yours?
  7. ffeingol

    ffeingol Member

    Yup, but what actually executes in the randhtml.cgi in the sies cgi-bin folder. This is what I have:

    Code:
    ls -l randhtml.cgi
    -rwxr-xr-x 1 abcdef abcdef 3144 Jul 27 13:47 randhtml.cgi*
    
    This is a very old account so it's possible it has an old version of randhtml.cgi within it's cgi-bin.
  8. NiteWave

    NiteWave Administrator

    please test at your side:
    Code:
    cp -a /usr/local/cpanel/cgi-sys/randhtml.cgi /home/abcdef/public_html/cgi-bin/randhtml_new.cgi
    and in the test.shtml, use
    Code:
    <!--#exec cmd="cgi-bin/randhtml_new.cgi abcdef"-->
    it works on both apache and lsws at our cPanel box.
  9. ffeingol

    ffeingol Member

    Will do, but we have to schedule that kind of change for the weekend.
  10. NiteWave

    NiteWave Administrator

    this one:
    Code:
    ls -l randhtml.cgi
    -rwxr-xr-x 1 abcdef abcdef 3144 Jul 27 13:47 randhtml.cgi*
    should be ok too.since it's same size as the one under public_html/cgi-bin at our cPanel box. so my previous suggestion about "cp -a ..." may not needed.

    so just change the code from
    Code:
    <!--#include virtual="cgi-bin/randhtml.cgi"-->
    to
    Code:
    <!--#exec cmd="cgi-bin/randhtml.cgi abcdef"-->
    will do.
  11. ffeingol

    ffeingol Member

    OK. Copied the newer cPanel binary over to the site. Changed the LSWS config so .shtml is no longer passed to Apache. Restarted LSWS. Does not work. In the error_log I see 'Premature end of response header.' for this site. If I add the user-id into the virtual statement I get an error (unable to process this directive).

    We had to revert back to Apache handling .shtml.
  12. ffeingol

    ffeingol Member

    What version of LSWS were you testing on because we have still had no luck with this.
  13. mistwang

    mistwang LiteSpeed Staff

    Need to change "#include virutal" to "#exec cmd", add user name parameter.

Share This Page