Skip to content. | Skip to navigation

Navigation

Personal tools

Web Applications

This guide shows how to build several web applications and servers. The basic concept is that of an Apache 2 webserver fronting several application servers (such as Apache Tomcat and Plone). We'll be hosting several domains and handling SSL. To avoid unnecessary rebuilding we'll attempt to reuse existing infrastructure.

PHP

PHP does everything and includes the kitchen sink. As such it's a bit of a beast to build. Once again we hit problems trying to convince it to find all the usual goodies that are on our system just not where the configure script is looking for it.

Building and Installing

As Solaris does have some goodies (plus what we've installed ourselves), we'll pick out what we can without too much effort.

Note

Solaris 10+ systems have improved their software portfolio by degrees even between monthly releases. YMMV.

./configure --prefix=/usr/local/${PWD##*/} \
 --with-apxs2=/usr/apache2/bin/apxs \
 --with-libxml-dir=/usr/local/libxml2-2.6.22 \
 --with-openssl=/usr/sfw \
 --with-zlib \
 --with-bz2 \
 --with-ndbm \
 --with-db4=/opt/sfw \
 --with-gd=/opt/sfw \
 --with-jpeg-dir \
 --with-png-dir \
 --with-zlib-dir \
 --with-xpm-dir \
 --with-mysql=/usr/local/mysql/mysql-standard-5.0.15-solaris10-i386 \
 --with-pgsql=/usr/local/postgresql-8.1.0 \
 --enable-soap

make

Sadly this will fail in the final compilation (of sapi/cli/php) as it cannot find fdatasync. Sun have put fdatasync in librt.so which no-one is any the wiser to. The compilation of sapi/cli/php is under the management of libtool which is way out of the league of this guide. We need a means to bodge -lrt into the link stage. Persual of the Makefile suggests we can overload ZEND_EXTRA_LIBS though you might want to check the current value first!

make ZEND_EXTRA_LIBS=-lrt

Continuing:

make test

Where we hit some test failures:

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #32555 (strtotime("tomorrow") can return false) [ext/date/tests/bug32555.phpt]
Bug #33532 (Different output for strftime() and date()) [ext/date/tests/bug33532.phpt]
date_default_timezone_get() function [1] [ext/date/tests/date_default_timezone_get-1.phpt]
date_default_timezone_set() function [1] [ext/date/tests/date_default_timezone_set-1.phpt]
EUC-JP to ISO-2022-JP [ext/iconv/tests/eucjp2iso2022jp.phpt]
EUC-JP to SJIS [ext/iconv/tests/eucjp2sjis.phpt]
iconv_mime_encode() sanity cheeck. [ext/iconv/tests/iconv004.phpt]
iconv_mime_decode_headers() [ext/iconv/tests/iconv_mime_decode_headers.phpt]
iconv_mime_encode() [ext/iconv/tests/iconv_mime_encode.phpt]
iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
iconv_strlen() [ext/iconv/tests/iconv_strlen.phpt]
iconv_strpos() [ext/iconv/tests/iconv_strpos.phpt]
iconv_strrpos() [ext/iconv/tests/iconv_strrpos.phpt]
iconv_substr() [ext/iconv/tests/iconv_substr.phpt]
ob_iconv_handler() [ext/iconv/tests/ob_iconv_handler.phpt]
Bug #29109 (Uncaught SoapFault exception: [WSDL] Out of memory) [ext/soap/tests/bugs/bug29109.phpt]
SPL: RecursiveIteratorIterator and begin/endIteration() [ext/spl/tests/iterator_025.phpt]
Bug #27646 (Cannot serialize/unserialize non-finite numeric values) [ext/standard/tests/math/bug27646.phpt]
=====================================================================

Ouch!

You can see what the complaints are by looking at files related to the string in square brackets. For example, the first test, ext/date/tests/bug32555.phpt has an associated diff file, ext/date/tests/bug32555.diff:

001+ Sat Apr 02 02:30:00 2005 EST
002+ Sun Apr 03 00:00:00 2005 EST
003+ Sun Apr 03 03:30:00 2005 EDT
004+ Mon Apr 04 02:30:00 2005 EDT
001- Sat Apr  2 02:30:00 2005 EST
002- Sun Apr  3 00:00:00 2005 EST
003- Sun Apr  3 03:30:00 2005 EDT
004- Mon Apr  4 02:30:00 2005 EDT

As you can see, whilst the failure is technically correct the problem is due to what the test expected (in a file with the .exp extension) which is incorrect for this system.

The I18N failures might well be genuine but the others are (almost) all not. You install at your peril!

As we'll be installing another module in /usr/apache2 we need to install as root.

Note

For whatever reason PHP insists on recompiling the Apache module at install time and, of course, the tree in /usr/local will be owned by root.

su
make install

PHP helpfully adds a LoadModule line for itself to httpd.conf but doesn't tell Apache how to handle PHP files. We need to add some configuration directives to httpd.conf:

<IfModule mod_php5.c>
 AddType application/x-httpd-php .php .phtml
 AddType application/x-httpd-php-source .phps
</IfModule>

Configuring

PHP itself doesn't seem to need as much configuring as it used to. Dangerous settings have sensible values (register_globals is off by default). However, if you want to change things around (for example if your database servers are not local), the configuration files should be in /usr/local/php-5.1.1/lib. You can have a per-SAPI (server API) config file, eg. php-apache2.ini if you want to be more specific.

For peace of mind, you may want to:

cp php.ini-recommended /usr/local/php-5.1.1/lib/php.ini

Document Actions