View Full Version : cPanel randhtml.cgi not working with LSWS SSI
ffeingol
09-07-2010, 11:34 AM
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.
mistwang
09-07-2010, 02:16 PM
can you please give some sample code that we could try in our lab?
ffeingol
09-07-2010, 02:31 PM
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:
<!--#include virtual="cgi-bin/randhtml.cgi"-->
NiteWave
09-08-2010, 12:04 AM
I created a page test.shtml
<!--include virtual="cgi-bin/randhtml.cgi user1"-->
("cgi-bin/randhtml.cgi" should follow user's account name)
in apache, the result:
[an error occurred while processing this directive]
in lsws, result is
"ERROR 404: Not Found"
although the result different, both not working.
can you further confirm it's working under apache?
ffeingol
09-08-2010, 04:45 AM
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.
NiteWave
09-08-2010, 05:34 AM
What version of cPanel/WHM are you running?
WHM 11.26.8
this is probably the original randhtml.cgi
~>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?
ffeingol
09-08-2010, 05:46 AM
Yup, but what actually executes in the randhtml.cgi in the sies cgi-bin folder. This is what I have:
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.
NiteWave
09-08-2010, 05:59 AM
please test at your side:
cp -a /usr/local/cpanel/cgi-sys/randhtml.cgi /home/abcdef/public_html/cgi-bin/randhtml_new.cgi
and in the test.shtml, use
<!--#exec cmd="cgi-bin/randhtml_new.cgi abcdef"-->
it works on both apache and lsws at our cPanel box.
ffeingol
09-08-2010, 06:16 AM
Will do, but we have to schedule that kind of change for the weekend.
NiteWave
09-08-2010, 06:38 AM
this one:
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
<!--#include virtual="cgi-bin/randhtml.cgi"-->
to
<!--#exec cmd="cgi-bin/randhtml.cgi abcdef"-->
will do.
ffeingol
09-11-2010, 08:55 PM
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.
ffeingol
09-13-2010, 12:04 PM
What version of LSWS were you testing on because we have still had no luck with this.
mistwang
09-13-2010, 12:42 PM
Need to change "#include virutal" to "#exec cmd", add user name parameter.