Menu

#38 boa and php integration

open
nobody
boa (32)
5
2006-08-01
2006-08-01
Anonymous
No

Hello
i wish to find some help on how to configure boa web
server in order to run php scripts

am using php-5.0.5 boaxxx18 sqlite redhat9

Discussion

  • Mumia W.

    Mumia W. - 2007-10-19

    Logged In: YES
    user_id=1917107
    Originator: NO

    PHP-CGI has a security feature that causes the
    interpreter to ignore command line parameters
    when invoked from within a web server. Instead
    of using the command line to find out what script
    to execute, php-cgi uses the environment variable
    SCRIPT_FILENAME.

    Boa has a bug. It does not set the SCRIPT_FILENAME,
    so you'll have to create a stub script that sets the
    SCRIPT_FILENAME before invoking php-cgi, e.g.:

    #!/bin/bash
    export SCRIPT_FILENAME=/var/www/myscript.php
    /usr/bin/php-cgi

    I've tested this solution with PHP4, and it works.

     
  • tyatsumi

    tyatsumi - 2007-10-29

    Logged In: YES
    user_id=1924154
    Originator: NO

    You can add the SCRIPT_FILENAME environment variable support
    by just adding a line in the boa source file.

    In src/cgi.c , after the line:
    my_add_cgi_env(req, "SCRIPT_NAME", req->script_name);
    add a line
    my_add_cgi_env(req, "SCRIPT_FILENAME", req->pathname);
    and PHP-CGI will work with no wrapper scripts.

    Note: since PHP will run as CGI,
    PHP scripts must have a header line like:
    #!/usr/bin/php-cgi
    and must have executable permission.

     

Log in to post a comment.