AppWeb provides a PHP module for the high performance execution of PHP applications and scripts. You may use the supplied PHP library or you can replace it with a custom PHP build of your own choosing. Alternatively, you can even run PHP using the CGI interface if you have your own PHP program that you wish use.
PHP is enabled by default in the AppWeb configuration file and is loaded via the LoadModule configuration directive.
LoadModule php4 libphp4Module AddHandler php4Handler .php
To use PHP, you need to create a web document with a ".php" extension. When your browser requests this page, AppWeb will automatically invoke PHP to process the page.
If you wish to use PHP via CGI, see the Using PHP via CGI section below.
When to Use PHP
is a widely-used general-purpose scripting language that is especially suited for enterprise Web development. It provides an object oriented programming language, numerous extensions and a broad developer community. The power of PHP comes at a price, it typically has a memory footprint of 1-2 MB for the PHP code alone and can be quite large (> 5MB) for large applications. For embedded systems, this is often too big and so we recommend using Embedded Server Pages for such systems.
Release Details
The PHP module is based on the PHP release 4.3.6 and 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 libphp4Handler.so on Linux and libphp4Handler.dll on Windows. These AppWeb modules load the PHP library which is called libphp4.so on Linux and libphp4.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
PHP5
At the time of this release, PHP5 is only under pre-release and so the binary distibution does not contain a PHP5 handler. An experimental PHP5 modules is supplied with the source code. To use it, you will need to build it from source and modify the AppWeb configuration file to disable the Php4 module and enable the Php5 module.
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 php4 libphp4Module # AddHandler php4Handler .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.
|