Using Pike on the Web

[ Start > PikeDevel > Using Pike on the Web ] [ Edit this Page | Show Page Versions | Show Raw Source ]

Writing Standalone Apps


Pike 7.7 and newer include the Web.CGI module, which can be used to easily develop CGI based applications in Pike. Note that this is probably your lowest performance option, as each request to the CGI will include the time required to start the Pike interpreter, as well as the time required to compile the application. If at all possible, it's better to use one of the persistent options below.


The Public.Web.FCGI module allows users to easily write applications for use with web servers that support FastCGI. This module uses the libfcgi library to provide excellent cross-server support.


The ScriptRunner application (see below) contains code for providing application services using the SCGI protocol. This protocol support can be adapted to your own needs fairly readily.


Pike includes support for building web servers within a Pike process. For simple needs, or highly specialized needs, this may be the way to go. See how to create a web server in pike by viewing Simple Web Server.

Frameworks and Application Servers


Pike ScriptRunner is a FastCGI/SCGI application that allows you to run Pike and PSP (Pike Server Pages) scripts from any web server that supports FastCGI or SCGI.


Fins is a web application framework that uses the MVC paradigm to build scalable, easily mantained applications. Similar in concept to Ruby on Rails, Fins offers powerful templating and data management functionality. Fins applications can be deployed via HTTP, FastCGI, SCGI or within Caudium.

Caudium / Roxen

Caudium and Roxen are both webservers written in Pike. However, they offer extendability and program development options that make them much more than just web servers. Built in Pike scripting and languages like RXML make rapid application development possible, even for non-programmers. The ability to add and update modules that extend and enhance server functionality on the fly, without restarts, makes these servers very powerful.

What about mod_pike?

While it's fair to say that mod_perl and mod_php are extremely popular solution for making a language available within a web server, the convenience does come at a high price. Stability, security and administrative headaches are some of the reasons to avoid embedded interpreters. The perceived performance advantages of using embedded interpreters mostly disappear when compared with persistent language engines, like ScriptRunner.

Persistent applications using protocols like FastCGI, SCGI or AJP provide the high performance of embedded interpreters without the associated risks. Depending on the approach you ultimately take, there may be some headache surrounding application process startup, but the benefits will quickly outweigh any trade-offs.

Coexisting with another Webserver

Because of Pike's strong internet protocol support, many tools listed above provide a HTTP interface. Sometimes, that's not the most ideal situation, as there's often a web server installed already.

The easiest way is to use mod_proxy on Apache, or the functional equivalent. This allows you to proxy any part of a server's virtual filesystem to another server that speaks HTTP.

AJP 1.3 is a cross-application server protocol that can be used to provide access to a Caudium server from within any Webserver that has an AJP connector (such as mod_jk in Apache). One advantage of this is that mod_jk2 can selectively pass requests based on extension, so for example, you can use Caudium to process .pike files. To enable AJP 1.3 on a Caudium virtual server, simply create a new port that uses the "ajp13" protocol. A second advantage is that you can get load balancing by providing multiple backend Caudium servers and configure mod_jk to use them.

Powered by PikeWiki2 | Copyright © 2004 - 2009 | Pike is a trademark of Department of Computer and Information Science, Linköping University