Building Appweb with PHP Support

Appweb includes support for the PHP Web Framework via a the FastCGI handler which runs the PHP php-cgi program.

Using PHP

If you wish to use PHP handler, build with FastCGI and enable the fastHandler in your appweb.conf.

To build Appweb with FastCGI support consult Building with FastCGI.

PHP over FastCGI Configuration

There is no default configuration for PHP with FastCGI in the supplied appweb.conf. You will need to add directives to your appweb.conf once Appweb is built with FastCGI support. The FastCGI handler is configured via the FastConnect configuration directive.

For example, to run PHP scripts:

LoadModule fastHandler libmod_fast
Action application/x-php ./run-php
FastConnect 127.0.0.1 launch
AddHandler fastHandler php
Target run $1

This configuration will run PHP scripts via a "run-php" script that defines certain PHP environment variables before invoking PHP.

#!/bin/bash
export PHP_FCGI_CHILDREN=0
export PHP_FCGI_MAX_REQUESTS=0
exec /usr/local/bin/php-cgi

This script will run the PHP executable with no children and unlimited requests.

© Embedthis Software. All rights reserved.