php4 - serving dynamic web pages


Table of Contents:


Introduction

php4's release has been much anticipated and OpenBSD has packaged different pre-compilations for direct installation. A direct binary package will most likely cater for the majority of peoples' needs.

This guide will help you install php4 with OpenBSD.

As of OpenBSD 3.2 and PHP4 rev4.2.3 the best way to install PHP4 is to use the packages.

Installing php4

[ref: http://www.php.net/manual/en/install.openbsd.php]

Read the above, clear and step-by-step, installation instructions.

Please remember to read the instructions specified after each package installation. You will be required at times to execute a program which will organise the binaries on your system, or to make changes to /var/www/conf/httpd.conf.

Configuring Apache

If you have followed the php4 installation correctly, then there should be no need to make additional changes to the apache configuration file.

Testing php.

The above echo "<?php phpinfo() ?>" > /var/www/htdocs/test.php will let you quickly check whether php is working by calling up the file test.php:

# lynx localhost/test.php
[ lynx displays the following ...]
 
PHP Version 4.0.4pl1

System OpenBSD hostname 2.8 GENERIC#399 i386
Build Date Today's Date
_______________________________________________________________________________________________________________

[ ... more stuff cut out ... ]
 

Of course if you have a browser that supports tables (AOL Navigator, or Microsoft Internet Explorer) then it would a look a lot nicer.

Further test scripts are available, but once the above is working you know you have a 'working' php configuration. The additional scripts can help you with debugging errors or if there are specific components you need to review. Two directories (test, tests) hold a number of different tests for checking the functionality of your php configuration.

Apache fails to start

After you restart your machine you may get an error during the restart, and when you attempt to manually start Apache such as the following:

# apachectl start

/usr/libexec/ld.so: httpd: libmysqlclient.so.6.0: No such file or directory

/usr/sbin/apachectl start: httpd could not be started

The problem is that the libmysqlclient.so.6.0 file is not in the standard path for the run-time linker ld.so. To ensure that the file is always included when the system is started you can either link the file to the standard location, or add the file location to the default search path.

Approach 1:

We can create a symlink of the library file into a standard library path such as /usr/local/lib/

# ln -s /usr/local/lib/mysql/libmysqlclient.so.6.0 /usr/local/lib/libmysqlclient.so.6.0

Approach 2:

We can include the new directory into the list of directories searched by ld.so and this can be done in the configuration rc.conf.local

edit /etc/rc.conf.local and add the following line in Section 3:

shlib_dirs="$shlib_dirs /usr/local/lib/mysql" # extra directories for ldconfig

This will override the existing setting in /etc/rc.conf which is usually:

shlib_dirs= # extra directories for ldconfig

We are using $shlib_dirs in the above example to expand whatever settings exist for shlib_dirs and then include our new directory. Note that you must use quotation marks and use a space between directory paths.

There are some security concerns about adding directories into the standard path for ldconfig so you should study the man pages.

Author and Copyright

Copyright (c) 2000/1/2 Samiuela LV Taufa. All Rights Reserved.

I reserve the right to be totally incorrect even at the best advice of betters. In other words, I'm probably wrong in enough places for you to call me an idiot, but don't 'cause you'll hurt my sensibilities, just tell me where I went wrong and I'll try again.

You are permitted and encouraged to use this guide for fun or for profit as you see fit. If you republish this work in what-ever form, it would be nice (though not enforceable) to be credited.

php4 - scripting the web.

Copyright  © 2000/1/2 NoMoa Publishers All rights reserved. Caveat Emptor