Embedthis Appweb 4.3.4
Home > Users Guide > PHP

# See Also

## Using PHP

Appweb supplies an in-memory PHP module that includes 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 mod_php.so. The module loads 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 (on Linux):

    ./configure \
        --disable-debug \
        --disable-rpath \
        --disable-cli \
        --enable-bcmath \
        --enable-calendar \
        --enable-maintainer-zts \
        --enable-embed=shared \
        --enable-force-cgi-redirect \
        --enable-ftp \
        --enable-inline-optimization \
        --enable-magic-quotes \
        --enable-memory-limit \
        --enable-safe-mode \
        --enable-sockets \
        --enable-track-vars \
        --enable-trans-sid \
        --enable-wddx \
        --sysconfdir=/etc/appWeb \
        --with-pic \
        --with-exec-dir=/etc/appWeb/exec \
        --with-db \
        --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 apparent 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 PHP versions, 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-2013. All rights reserved. Embedthis, Appweb, ESP, Ejscript and Embedthis GoAhead are trademarks of Embedthis Software LLC.