Embedthis Appweb 3.0A.0
Home > User's Guide > PHP

Quick Nav

When to Use PHP
Release Details

Using PHP via CGI

See Also

User Guide Overview
Appweb Architecture
Configuring Appweb
Configuration Directives
Ports and Binding
Authorization
Secure Sockets Layer (SSL)
Virtual Hosts
Creating Dynamic Web Pages
Embedded Server Pages
Using Embedded JavaScript
Using CGI
Loadable Modules
Handlers
HTTP Client

Release Details

Appweb supplies two PHP modules. One based on PHP 5.0.0 and one based on PHP release 4.3.6. These modules are built with support for sessions, sockets, MySQL, XML, XML-RPC, regular expressions, large math, calendar functions, multi-byte strings, the pear library and the Berkeley database.

The Appweb PHP module is called libphp5Handler.so on Linux and libphp5Handler.dll on Windows. These Appweb modules load the PHP library which is called libphp5.so on Linux and libphp5.dll on Windows. You may replace the PHP library with a custom build from the PHP source base if you wish.

The supplied PHP library was configured with the following configuration options:

configure \
    --cache-file=config.cache \
    --disable-debug \
    --disable-rpath \
    --enable-bcmath \
    --enable-calendar \
    --enable-experimental-zts \
    --enable-embed=shared \
    --enable-force-cgi-redirect \
    --enable-ftp \
    --enable-inline-optimization \
    --enable-magic-quotes \
    --enable-memory-limit \
    --enable-mbstring \
    --enable-mbstr-enc-trans \
    --enable-mbregex \
    --enable-pic \
    --enable-safe-mode \
    --enable-sockets \
    --enable-track-vars \
    --enable-trans-sid \
    --enable-wddx \
    --sysconfdir=/etc/appweb \
    --with-exec-dir=/etc/appweb/exec \
    --with-db4 \
    --with-mysql \
    --with-regex=system \
    --with-pear \
    --with-xml \
    --with-xmlrpc \
    --with-zlib

Using PHP via CGI

If you need to use PHP via CGI, be aware that PHP will run much more slowly. This will be especially aparent for small scripts where the load time for each script will be the dominant overhead.

To use PHP via CGI, you will need to disable the PHP module if you want your script to use the ".php" extension. If your scripts do not use this extension, you can keep the PHP module enabled. To enable PHP via CGI, add (or uncomment) the following lines in the appweb configuration file :

AddHandler cgiHandler .cgi .cgi-nph .bat .cmd .pl .py
Action application/x-appweb-php /usr/bin/php

To disable the PHP module, ensure that you have commented out the following lines:

# LoadModule php5 libphp5Module
# AddHandler php5Handler .php

When PHP is started as a CGI interpreter, it expects that the SCRIPT_FILENAME environment variable be set to the name of the script to execute. In early version of PHP, it incorrectly looked at PATH_TRANSLATED to have the name of the script. To ensure that PHP behaves correctly and looks in SCRIPT_FILENAME, ensure that the cgi.fix_pathinfo is set to 1 in the php.ini file.

© Embedthis Software LLC, 2003-2009. All rights reserved. Embedthis, Ejscript and Appweb are trademarks of Embedthis Software LLC.