cPanel randhtml.cgi not working with LSWS SSI

ffeingol

Well-Known Member
#1
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.
 

ffeingol

Well-Known Member
#3
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"-->
 

NiteWave

Administrator
#4
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

Well-Known Member
#5
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

Administrator
#6
What version of cPanel/WHM are you running?
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?
 

ffeingol

Well-Known Member
#7
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.
 

NiteWave

Administrator
#8
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.
 

NiteWave

Administrator
#10
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.
 

ffeingol

Well-Known Member
#11
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.
 
Top