Building Appweb with PHP Support

Appweb includes support for the PHP Web Framework via a the CGI handler which runs the PHP CLI or via an in-memory Appweb extension pack appweb-php. The in-memory handler is highly efficient and much faster in processing PHP requests than the CGI handler.

Using PHP via CGI

If you wish to use PHP via CGI, you do not need the appweb-php package handler. Simply build Appweb with CGI support and run the standard PHP cli command. Also be aware that PHP via CGI will run much more slowly than using the appweb-php in-memory PHP handler. This will be especially apparent for small scripts where the load time for each script will be the dominant overhead.

To build Appweb with CGI support consult Building with CGI.

Using the in-memory PHP handler

The appweb-php package implements the Appweb in-memory handler for PHP 5.X and does not include the source code for PHP which is very large. PHP 7 is not supported.

The Appweb PHP handler is called mod_php.so and the handler loads the actual external PHP library which is called libphp*.so on Linux and libphp*.dll on Windows.

Building Appweb with PHP

Perform the following steps at the top level of the appweb source tree.

Starting with Appweb 7.1.1 and 8.0, the appweb-php package is included with the Appweb source distribution. Some earlier releases may have included the package which resides at src/appweb-php. If your distribution does not include appweb-php, use the following steps to download it.

Download appweb-php

pak install appweb-php

Alternatively, if you wish to install appweb-php manually:

cd appweb-src-home
curl https://github.com/embedthis/appweb-php/archive/master.tar.gz >appweb-php.tgz
mkdir src/appweb-php
cd src/appweb-php
tar --strip-components 1 -xvf ../appweb-php.tgz

Building with PHP

Visit: https://php.net/ to access the PHP source and instructions for building.

Configuring and building with PHP

Once PHP is built, you can configure Appweb for building with PHP. If you are building with MakeMe, then use the following:

./configure --with php=/path/to/php-source
me

If you are building with make first copy the built PHP library into your build/*/bin directory. Then use:

make ME_COM_PHP=1 ME_COM_PHP_PATH=/path/to/php

Configuration

The PHP handler is enabled via the appweb.conf configuration file directives:

LoadModule phpHandler libmod_php
AddHandler phpHandler php

© Embedthis Software. All rights reserved.