Standalone PSP

[ Start > PikeApps > Standalone PSP ] [ Edit this Page | Show Page Versions | Show Formatted ]


This is the Web.PikeServerPages.PSPCompiler class from [PikeApps/Pike ScriptRunner], modified to run as a standalone CGI script, so no server-specific customization at all is needed.  Place it somewhere (/usr/local/bin/pikesp for example), and put the following at the top of your PSP page:

{code}
#! /path/to/pike /usr/local/bin/pikesp
{code}

This line will be removed from the output.  Make sure your PSP page ends with a CGI extension (.cgi for example).  Note that each invocation will launch a new pike process, so be careful not to use complex modules like Calendar or your page-per-second rate will drop like a stone.  Because of this, the following functions from Parser.HTML (which includes Calendar) are included directly in the script:


- html_encode_string
- http_decode_string
- http_encode_query
- http_decode_urlencoded_query


If you want to process forms, you'll have to parse them yourself:

{code}
/* merge GET and POST data into 'form' */
mixed form = http_decode_urlencoded_query(getenv("QUERY_STRING")||"");
form += http_decode_urlencoded_query(Stdio.stdin->read());
{code}

{link:Download|http://www.evoy.net/pike/pikesp.txt}

Powered by PikeWiki2

 
gotpike.org | Copyright © 2004 - 2009 | Pike is a trademark of Department of Computer and Information Science, Linköping University