Home > Getting Started > FAQ

Quick Nav

See Also

Appweb™ FAQ

If you don't find the answers you need here, please submit your question to the online community support Forum.

Questions

General Questions

Building Questions

Diagnostic Questions

Embedded Questions

Answers

What web framework should I use for my dynamic web application?

See the detailed Web Framework Comparison

Can I disable features to minimize memory footprint at run-time?

Yes. Appweb loads request handlers, scripting engines and other functionality via a run-time module loading mechanism. Via the Appweb configuration file, you can selectively enable the loading of function modules. For example, if you don't require CGI, comment out the LoadModule cgiHandler directive.

How can I upload large files?

You need to increase the LimitRequestBody limit in the appweb.conf file. This imposes a maximum upload file size. Some samples have a MAX_FILE_SIZE input field in the HTML form. This however, is just a hint to the browser, and is only processed by some browsers.

Can I replace the PHP library?

Yes, you can replace the Appweb-supplied PHP library with either the library from the standard PHP distribution or a custom PHP library of your own building. The Appweb PHP library is not special. It is a PHP configuration that omits features to create a small PHP library. To replace the PHP library replace the the file named either: libphp.so, libphp.dylib or php5ts.dll

How can I rebuild PHP?

Building PHP can sometimes be tricky, especially on Windows. We provide snapshots of various packages at https://github.com/embedthis/packages. This URL is a Git repository for PHP, OpenSSL and MatrixSSL with Makefiles to assist those wanting to rebuild these packages.

NOTE:These packages are not supported. They are provided as a service only.

If you are building Ubuntu Linux, you will need to run the following command to get the necessary tools and prerequisites.

apt-get install build-essential libxml2-dev libdb-dev

To get the PHP package, use the git tool to download the packages:

git clone http://github.com/embedthis/packages
This is a big download, please be patient.

In the php sub-directory you will find a Makefile which has configure settings for PHP on various platforms. This Makefile disables most features to build a minimal PHP configuration. Edit this to suit your configuration.

On Linux, use the following configuration:

./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

For Windows, use the following configuration:

cscript /nologo configure.js \
  --without-gd --disable-bcmath --disable-calendar --disable-com-dotnet \
  --disable-filter --disable-json --disable-ipv6 --disable-odbc \
  --disable-reflection --disable-tokenizer --disable-zlib --disable-ftp \
  --enable-embed --enable-zts --without-dom --without-libxml

On MAC OS X, use the following configuration:

./configure --disable-debug --disable-rpath --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

Once you have a new PHP library, you can reconfigure and build Appweb to use this PHP library. Here is a typical Appweb configure command to use PHP:

./configure -with php=/dir/to/php

If I rebuild the source, can I disable features at compile time?

Yes. When Appweb is built from source, a single bld.h header controls exactly what features and modules are built into the server. For example, if you don't require HTTP Keep-Alive support, and you wish to minimize memory footprint, you can modify the MPR_FEATURE_HTTP_KEEP_ALIVE definition to be '0'.

How can I trouble-shoot with trace?

Run appweb or winAppweb with the logging switch "--log". The logging switch takes the following parameters:

appweb --log logName[:logLevel]

Where logLevel is a number between 0 and 9. Zero is the least verbose. To debug HTTP requests, a level of 6 provides the detail of all the request/response exchanges.

How can I use CGI?

Appweb is configured by default to run CGI programs. If you do need to modify the CGI configuration, the following may help:

The configuration file directives for CGI are:

AddHandler cgiHandler cgi bat cmd pl

This instructs Appweb to run the CGI handler for specified file extensions. You can also use CGI for URLs that begin with a given prefix. By default, there is already a Location block defined for /cgi-bin in the default appweb.conf. Any files under this URL (http://host/cgi-bin/scriptName) will also run as CGI scripts. To run a given interpreter (for example Perl), you can just include

#!/bin/perl 
in the first line of your script (replace the /bin/perl path to point to your interpreter), and make sure your script has a .pl extension. Alternatively, you can change the path specified in the ActionProgram directive to point to your perl interpreter.

Here is the list of CGI variables that are defined for Appweb under CGI and PHP:

AUTH_TYPE 
CONTENT_LENGTH 
CONTENT_TYPE 
DOCUMENT_ROOT 
GATEWAY_INTERFACE 
HTTP_ACCEPT 
HTTP_CONNECTION 
HTTP_HOST 
HTTP_USER_AGENT 
PATH_INFO 
PATH_TRANSLATED 
QUERY_STRING 
REMOTE_ADDR 
REMOTE_HOST 
REMOTE_USER 
REQUEST_METHOD 
REQUEST_URI 
SCRIPT_NAME 
SERVER_ADDR 
SERVER_HOST 
SERVER_NAME 
SERVER_PORT 
SERVER_PROTOCOL 
SERVER_SOFTWARE 
SERVER_URL

What is the difference between handlers and modules?

Modules are just for the basic loading mechanism of shared objects (DLLs). However, they also provide a consistent way to handle modules that are statically loaded without much effort on the part of the developers.

Handlers are the work-horses for the HTTP server. They actually process the HTTP requests and have full access to the request. They also own its processing.

How small can I make Appweb?

Appweb 2 has about 800K of code. On a VxWorks or uClibc based Linux system, you should be able to build Appweb for a 1MB memory footprint. It will be larger if you use OpenSSL and much larger if you use PHP (which is +5MB).

For a minimal footprint on Appweb, use:

./configure --without all ... more options ...

This will disable all possible features but still provide a running web server. Then add various --set option=value and --with component switches as required.

Things to consider when building small.

  • Don't use PHP.
  • Disable all possible features. In particular, disable the PHP, CGI and Ejscript modules.
  • Don't build DEBUG. Use: ./configure --release
  • Use the ESP web framework.
  • Use a small C-Library such as uClibc on embedded Linux systems.

How can I cross compile?

The Appweb configure command has switches to specify the target platform. For example:

./configure --platform vxworks-ppc

When cross compiling, you also need to tell configure about your cross compilation tool chain. This means the names of your compiler, library archiver, and other utilities and flags. The configure program listens to the settings of the AR, CC, NM, RANLIB, STRIP, CFLAGS, IFLAGS and LDFLAGS environment variables and will pass their values into the build system. These will be used to define the cross compilation tool chain. You can also specify an alternate build tool chain by using the same variables but with a BUILD_ prefix. For example:

DIR=/path/to/cross-tools ; \
AR=$DIR/bin/ar.exe \
CC=$DIR/bin/cc.exe \
LD=$DIR/bin/cc.exe \
NM=$DIR/nm.exe \
RANLIB=$DIR/ranlib.exe \
STRIP=$DIR/strip.exe \
CFLAGS="-I$DIR/include \
./configure --debug --platform linux-arm

For more details, please read: Cross Compilation in the Building from Source guide.

Need more help?

If you have any further questions, please go to the Appweb community support Forum.

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