Pike + LSWS ?

#1
Hello, i'm learnig Pike from half year (easy to learn, highly object oriented, faster than php, python or ruby). It would be fantastic to use it with lsws trough ScriptRunner (that uses fastcgi), instead of writing own web daemons or caudium/roxen web servers. Scriptrunner module has been tested with apache and lighttpd with fcgi or scgi.

Have someone tried to configure Pike + Scriptrunner + lsws?

I tried and it's not working for me. :( And i completly dont understand how to configure some fastcgi apps to work.

I installed pike, libfastcgi, Public.Web.FastCGI as they said in tutorial and tested modules correctly, then i installed scriptrunner. And from here i dont now what to do. For apache it must be made this:
Add a redirect to convert all requests to (*.pike) to /path/to/scriptrunner.fcgi($1) (actual syntax will vary based on the redirector you're using.

For example, if I've installed ScriptRunner so that the ScriptRunner.fcgi is called by the following request:

www.mysite.com/path/to/ScriptRunner.fcgi

and I put a pike script in /some/other/path.pike on my website, I need my redirect to internally change

www.mysite.com/some/other/path.pike

to

www.mysite.com/path/to/ScriptRunner.fcgi/some/other/path.pike

This is a common technique used by PHP and other languages. Alternately, you could use mod_actions to do the same thing:

AddHandler scriptrunner-pike-script .pike
AddHandler scriptrunner-pike-script .psp
Action scriptrunner-pike-script /path/to/ScriptRunner.fcgi
So in server External Applications i added FastCGI App:
Name: PikeScripts
Address: UDS://tmp/lshttpd/myfcgi.sock
Max Connections: 10
Auto Start: Yes
Command: /usr/local/scriptrunner/ScriptRunner.fcgi
etc.
and Script Handler:
Suffixes: pike
Handler Type: Fast CGI
Handler Name: [SERVER LEVEL]: PikeScript

I tried also adding fcgi Script Handler and then rewriting pike files to scriptrunner.fcgi, but it is always waiting several seconds and showing 503 Service Unavaible. scriptrunner logfiles shows nothig. :(

Can somebody help me with this?
 

xing

LiteSpeed Staff
#2
Jetro,

Can you set

Log Level: Debug
Debug Level: High

And run 2 requests with the pike FCGI in place and post the log. Don't need to run more than 2 requests since the debug level generate a lot of data and there is no need for duplcates.
 

mistwang

LiteSpeed Staff
#4
Please try following:

1. remove script handler for .pike
2. define a fast cgi context with uri /ScriptRunner.fcgi , or whatever URL you like.
3. Try a request like http://www.mysite.com/ScriptRunner.fcgi/foo.pike, foo.pike should be under the document root.
4. If above works, add a matching context, with URI: exp: /(.*\.pike)$, location: /ScriptRunner.fcgi/$1 , this should do the trick described in the document you posted. You can use URL rewrite to do the same thing as well.

Not sure Pike's fcgi implement support persistent connection or not, you can try flipping "persistent connection" on or off in the ScriptRunner FCGI application.

Please let us know it works or not. :)
 
#5
Today i've seen that on official faq there is one point missing! They don't wrote that in ../scriptrunner_install_dir/lib are pike modules that must been copied to the ../pike_install_dir/lib/modules. ;)

I added context as you said, mistwang, then used URL rewrite and here are the results:
http://gmclan.org/test.pike :)
source:
Code:
mapping parse(object id)
{
        string output = "<html><body><h1>Hello World from Pike!</h1></body></html>";
        string mimetype = "text/html";

return ([ "data" : output, "type" : mimetype ]);
}
Not sure Pike's fcgi implement support persistent connection or not, you can try flipping "persistent connection" on or off in the ScriptRunner FCGI application.
Yes, persistent connection is supported. Is this option affect to the performance?
 
Top