Contributed by Dengue on from the return-of-php dept.
OpenBSD 2.6 includes Apache 1.3.9, with shared object support available. With this in mind, I decided to add PHP as an Apache DSO. For those unfamiliar with this concept, instead of a monolithic static Apache binary, I opted instead to create a dynamic Apache module that can be loaded at runtime. Thanks to work by Kevin Lo , PHP support can be built either from the ports tree , or from source.
As an OpenBSD port
The port builds without error on 2.6 using the standard OpenBSD ports building method: make && make install Before you build however, it is best to customize the Makefile to your particular needs. Kevin only includes the following options in the standard port:
CONFIGURE_ARGS= --with-apxs=/usr/sbin/apxs CONFIGURE_ARGS+= --without-pcre-regexTo customize this for your site, simply add other configure arguments to the makefile. For instance, if you want MySQL support add:
CONFIGURE_ARGS+= --with-mysqlOther options can be seen by running ./configure --help in ./work/php-3.0.14 and looking at the available options.
This is the easiest way to add Php support to OpenBSD 2.6.
Php can be a troubled child for OpenBSD users, often not building well. That is also the case with version 3.0.14. Fortunately, the problem is documented at Php's impressive online bugs database. In a nutshell, attempts to build php-3.0.12-14 will fail with: Definition of symbol `_pcre_*' (multiply defined) errors. The way to get around this, as documented at php.net is:
./configure --with-mysql --with-apxs=/usr/sbin/apxs --with-config-file-path=/var/www/conf --with-gd=/usr/local --without-pcre-regex <<This is important --with-gdbm --with-xml --enable-track-vars --enable-magic-quotes
Install php, this will automagically copy the libphp3.so module to the proper directory, and insert the correct
lines in your
# make install
# apachectl restart ;tail -f /var/www/log/error_logand you should see this:
[Thu Jan 13 22:44:46 2000] [notice] Apache/1.3.9 (Unix) PHP/3.0.14 mod_ssl/2.4.5 OpenSSL/0.9.4 configured -- resuming normal operations
That's all there is to it.
(Comments are closed)