BOA + PHP for uClinux

Software download

The uClinux distribution needed is 20040218 (because of uClibc 0.9.26).

Download the following files :

Installation

extract boa and php tarballs into the uClinux-dist/user directory, then apply the patch as follow:

cd path_to_boa_subdir; zcat path_to_boa_patch_file | patch -p1
cd path_to_php_subdir; zcat path_to_php_patch_file | patch -p1

Note that boa is not modified in any way for php, the patch provided for boa is to make it run on uClinux, it may be used without php.

Compilation

manually add the the necessary config option to compile php (in uClinux-dist/config/config.in and uClinux-dist/user/Makefile), boa should already be defined in those files.

make xconfig

add boa and php package in the build then compile a new image.

Runtime installation

The php binary needs to be installed into the cgi-bin directory /home/httpd/cgi-bin (the makefile is taking care of this).

boa.conf is installed in /etc, the previous installation of boa might have placed this file in /home/httpd, if one is present in this directory, boa will not use it.

The default docroot for uClinux is /home/httpd, if you place a page index.php in this directory, you need to prefix the uri with /cgi-bin/php to have php process this page.

A simple php hello world example would be:

<html>
 <head>
  <title>Test PHP</title>
 </head>
 <body>
  <?php echo '<p>Hello world !</p>'; ?>
 </body>
</html>

copy this to /home/httpd/index.php in your romfs image. To call this page, enter this url in your browser :

http://your.host/cgi-bin/php/index.php

I have not yet tried to make boa recognize the .php extension, but using a specific mime type for cgi, boa is able to process .cgi page outside /cgi-bin so I guess it should be possible.

Example PHP scripts New

Here is some PHP scripts that run fine with this port, they have been modified to take into account the cgi environment: the variable PHP_SELF is usually used to refer to the script itself, but in a CGI environment, one should use REQUEST_URI instead. Generally changes are needed because the script url differ from the script name by the prefix /cgi-bin/php/, this prefix is mandatory for all the php page url.

Download this tar file and unpack it into your docroot directory on the board fle system, then call /cgi-bin/php/index.php to try the examples.

PHP setting

To build the first version of PHP (the old PHP 4.3.4 patch) for uClinux, I did disable all optional features (./configure --disable-all). In the second version (PHP 4.3.10 patch) only some features have been disabled, because of the lack of the corresponding libraries, the configure command was: ./configure --disable-mysql --disable-xml --disable-pear --disable-ipv6 this makes this version a lot more usable.

To compile your own PHP version, the process would be:

sig