[ Back to main index ] | [ Show all FAQs on a single page ]

Scripting Roxen & Chilimoon

Using scripting languages with Roxen and ChiliMoon (Inline Pike, Java, Perl, PHP, CGI etc.)

How can I use PHP with Roxen / ChiliMoon?

Posted at 2004-11-14 by Michael Stenitzer, Last updated at 2005-05-21 by Sascha Nemecek

Run PHP as CGI (Roxen and ChiliMoon)

  1. Compile PHP4 as a CGI (default). You end up with a binary file called "php".
  2. On your Roxen site configuration make sure the following modules are enabled.
    • CGI executable support
    • PATH_INFO support
    • Redirect Module
  3. Copy the "php" binary to the /cgi-bin/ directory of your site.
  4. Add a redirect pattern in the redirect module:
  /(.*)\.php(.*)$         /cgi-bin/php/$1.php$2 

Note: This is for php files ending in ".php".

Note2: Remember to set the correct values in php.ini to work with a PHP binary safely (see www.php.net/ )

Note3: For M$ windows users the redirect patern should be:

 /(.*)\.php(.*)$         /cgi-bin/php.exe/$1.php$2 

Use the PHP scripting support module (ChiliMoon) UNVERIFIED

Note: according to some unverified information this solution is not working with threads.

Use Scripting: PHP Support. This module allows ChiliMoon/Caudium users to run PHP scripts, optionally in combination with RXML.

  • Get PHP4
  • Configure PHP4 with --with-roxen=/usr/local/ChiliMoon/2004/server (--enable-roxen-zts)
  • Make and install PHP4
  • Restart ChiliMoon
  • Add the "PHP 4 Script Support Modul"

Applies to: Roxen , ChiliMoon
Status: Answer to be confirmed

How can I access RXML variables inside an Pike tag?

Posted at 2004-11-14 by Michael Stenitzer, Last updated at 2004-12-09 by Michael Stenitzer

Variables are available within your script just like in RXML but written in the form scope.variable instead of the entity style &form.scope; .

 <set variable="var.test" value="test" /> 
 <?pike  
 write("<h2>"+var.test+"</h2>"); 
 var.test = "prost"; 
 ?> 
 <h2>&var.test;</h2> 

See the documentation docs.roxen.com for further parsing information.

Applies to: Roxen , ChiliMoon

What is the difference between <?pike ?> and <pike>/ ?

Posted at 2004-11-14 by Michael Stenitzer

The <pike>/ container is depreciated, but still available in the way it was in Roxen 2.

  • <pike>/ container will not be parsed (i.e. your variables and other functionality are not available in the way they are in the Pike processing instruction)
  • the comparison operators '<' and '>' will cause an error within a <pike>/ container. Use &lt; and &gt; instead.

Applies to: Roxen , ChiliMoon

Inline Perl: Why do I have to declare variables before using them?

Posted at 2004-11-14 by Michael Stenitzer

To avoid memory leaks in Perl, the Perl support in Roxen runs under the pragma "use strict" which requires variables to be declared.

Note: The memory leaks aren't permanent, since the subprocesses get restarted now and then.

Applies to: Roxen , ChiliMoon
Status: Answer to be confirmed

Inline Perl: How can I access RXML variables?

Posted at 2004-11-14 by Michael Stenitzer

Example how to read and write RXML variables:

 <perl>  
 my $variable = '&var.test;';   
 print $variable ;    
 print '<set variable="var.test" value="asdasd" />'; 
 </perl> 

If you use the processing instruction <?perl ... ?> instead, RXML variable are not available since it doesn't RXML-parse its content. Therefore you don't need quoting (unless you want "?>" inside a string in your Perl code).

You can not access something like id->variables from within a <perl>/ container as the Perl tag is evaluated in a separate subprocess that has no access to the RequestID object. (to be confirmed)

The form variables are available in the internal hash %Roxen::Request::req_vars. There is a function $r->get_http_variables that returns this hash. (to be confirmed)

Applies to: Roxen , ChiliMoon

How can I resolve this internal server error when I want to run a CGI script?

Posted at 2004-11-15 by Michael Stenitzer, Last updated at 2004-12-09 by Michael Stenitzer

 Error: Process.create_process(): Access denied. 
 _builtin.create_process:create(({"  "}),mapping[11]) 
 _builtin: create_process() modules/scripting/cgi.pike (version 2.36):748: run() 
 ... 

An error like this is usually based on wrong owner settings of the CGI script. Check if the CGI script is executable for the user running the script.

Applies to: Roxen , ChiliMoon

[ Back to main index ] | [ Show all FAQs on a single page ]