Next Previous Contents

3. Installation of Other Packages needed by ActionApps

3.1 Platform

The installation instructions given here are intended for use with RedHat Linux. We used version 6.0 and 6.2. This specifically means that the rpm tool is used wherever possible.

If your system does not support the rpm tool, most procedures will be quite different from what is shown here. You will probably have to do most installations by building the software itself. It is beyond the scope of this document to describe that although necessary configurations options will be mentioned.

3.2 MySQL database back end

Check if you have already MySQL 3.22.32 or newer installed:


% rpm -q MySQL

If MySQL has been installed from source ,then RPM will report it is not installed, try "ps efax | grep mysql" to see if it is running, and if it is then either "/usr/sbin/mysqld -V" will report the version on newer versions. If this doesn't exist then running the client with, "mysql" should report the version number it is connected to.

If it is not installed or if the version used is too old, install it. If you don't have a CD with MySQL RPM files, download it from http://www.mysql.com/downloads/mysql.html. (MySQL is not included in RedHat Linux.) Use the stable release version. Get files from the "standard binary RPMs" part: "Server for ... systems", "Client programs for ... systems" and "Include files and libraries for development for ... systems". (The latter is needed re recompile php if this has to be done, see below.)

As root, install the RPMs:


# rpm -Uv MySQL-3.22.32-1.i386.rpm

This command will install the MySQL database server, create some administrative tables and already start the server itself. It also creates a file in /etc/rc.d/init.d/ and symbolic links in /etc/rc.d/rc?.d/ so the server is started and stopped properly on system start and shutdown.

Also install the MySQL client tools and the development files and "shared" :


# rpm -Uv MySQL-client-3.23.43-1.i386.rpm
# rpm -Uv MySQL-devel-3.23.43-1.i386.rpm
#rpm -Uv MySQL-shared-3.23.43-1.i386.rpm

Since the server is now running, it can be accessed. It is a good idea to immediately set a password for the MySQL root user. Remind the password - better not use mysqlpass for obvious reasons. We will refer to this password as the mysql root password.

# mysqladmin -u root password 'mysqlpass'

 

3.3 OpenLDAP

Package Installation

Note: You only need the OpenLDAP server if you decided to use LDAP as the permission system. Only do this if you know what you are doing. Generally, people use mysql as their permission system

If you to install OpenLDAP, see the apc-aa LDAP page

3.4 Installing the Apache Web Server

Use the RPM that comes from RedHat. We have had success with the versions 1.3.9 and 1.3.12. You need to install the "devel" packages, too.

To find out which version of apache httpd you have, use:


% httpd -v
Server version: Apache/1.3.9 (Unix)  (Red Hat/Linux)
Server built:   Apr  7 1999 17:17:41

To install the apache web server, use these commands. Not that in this example, the apache itself was already installed, but the development package was missing (this is the default case for RedHat Linux).


# rpm -Uv /mnt/cdrom/RedHat/RPMS/apache-1.3.9-7.i386.rpm
package apache-1.3.9-7 is already installed
# rpm -Uv /mnt/cdrom/RedHat/RPMS/apache-devel-1.3.9-7.i386.rpm
apache-devel-1.3.9-7

Configuring the web server is a task for a later point in time because RPM will do part of this work.

3.5 PHP3

PHP installation

php runs within the apache web server as a module. We need a version of php which includes support for two optional php modules, namely ldap and mysql. These modules provide access to ldap and mysql databases, respectively, from php programs. (If you don't use ldap with the ActionApps, you will not need the ldap php support.)

There are many ways to install all this, and many can generate a lot of trouble. The cleanest and easiest way is, again, to use RPMs.

Note that these instructions were written for installing PHP3. PHP4 has been tested and works, but noone so-far has followed these installation instructions, which have been edited for consistency with php4. An updated version of this section for PHP4 would be welcome.

There where problems with the RedHat RPM's for PHP4, and some other configuration problems which are detailed at the end of this section.

Testing php installation

First, create a test WWW page to find out the status of php support on your system. This can be done easily by executing this command (assuming /home/httpd/html is your DocumentRoot directory:


echo "<?php phpinfo() ?>" > /home/httpd/html/test.php

Access the page with a web browser (http://localhost/test.php).

Installing PHP

Unfortunately, as of this writing, there is no mysql support for php which comes as an rpm made by RedHat. There are some mysql modules for php on the RedHat server, but they are all for older versions of php.

RedHat 6.1 and 6.2 above have a php rpm which is prepared for inclusion of other php modules. The ldap module is provided. The mysql module is not provided, but it is possible to build the mysql module. The advantage of going this way is that you will have the RPMs which are easy to install on all your machines and that the RPM install scripts will manage necessary configuration file changes by themselves. The disadvantage is that the RPM build process requires some more packages installed. This is described in the next section.

If you don't want to use RPMs, you must build PHP the traditional way. This is described in the sections following the next section.

Building the PHP RPMs including mysql

  1. To build the PHP RPMs including the mysql support, you need the following packages installed which you find at www.redhat.com:
  2. In order to build RPMs, you need an RPM build environment. For a quick setup of this, use the following commands:

    % mkdir ~/rpmbuild ~/rpmbuild/RPMS ~/rpmbuild/SRPMS ~/rpmbuild/BUILD ~/rpmbuild/SOURCES ~/rpmbuild/SPECS; echo "%_topdir ${HOME}/rpmbuild" >~/.rpmmacros
    

  3. You need the php source RPM from RedHat and install it (do not install it before you have the RPM build environment):

    % rpm -Uv php-3.0.15-2.src.rpm
    

    In this example, the php source rpm version 3.0.15-2 was used.
  4. Edit the file ~/rpmbuild/SPECS/php.spec. This file is the description used by rpm to build the php packages, and the mysql section is commented out (this is the reason for the fact that there is no mysql module for php on the RedHat server). You need to uncomment all lines which concern mysql, and you need to add a section describing the mysql package. There is a patch which does the right thing for the version 3.0.15-2; the patch can be found in the ActionApps doc directory as php-spec.patch. To apply this patch, copy it to the ~/rpmbuild/SPECS directory and use this command:

    % cd ~/rpmbuild/SPECS; patch < php-spec.patch
    

  5. Run the rpm build process:

    % rpm -ba ~/rpmbuild/SPECS/php.spec
    

    This will take some time. After everything is done, you will find all the RPMs in the directory ~/rpmbuild/RPMS/i386/.

If you had already php installed, better uninstall it before you install the new versions.


# rpm --erase --nodeps php php-manual php-mysql php-ldap php-pgsql php-imap
# rpm -iv php-3.0.15-2.i386.rpm php-manual-3.0.15-2.i386.rpm php-mysql-3.0.15-2.i386.rpm php-ldap-3.0.15-2.i386.rpm
php-3.0.15-2
php-manual-3.0.15-2
php-mysql-3.0.15-2
php-ldap-3.0.15-2

On installation, RPM will edit the apache web server configurations file (/etc/httpd/conf/httpd.conf) and php initialization file (/etc/httpd/php.ini) automatically.

Building PHP3 without RPMs

If you don't want to use RPM for PHP3 installation, you can as well build it from the scratch. If you want to do this, you will need

Unpack the PHP3 distribution, change into that directory, configure and build. This example shows a build with the LDAP module; remove the --with-ldap if you don't use LDAP:


% tar xvfz php-3.0.16.tar.gz
% cd php-3.0.16
% ./configure -with-mysql=yes --with-apxs=/usr/sbin/apxs --enable-track-vars --enable-safe-mode --with-xml --with-ldap --with-config-file-path=/etc/httpd
% make
# make install
/usr/sbin/apxs -i -a -n php3 libphp3.so
cp libphp3.so /usr/lib/apache/libphp3.so
chmod 755 /usr/lib/apache/libphp3.so
[activating module `php3' in /etc/httpd/conf/httpd.conf]

3.6 Configuring the apache web server

During the PHP3 installation using RPMs, most of the configuration work for the web server is already done. If you didn't use RPM to install PHP3, you might have to do the following steps. (It does no harm to double check if everything is configured correctly anyway.)

The configuration for the apache takes place in the file /etc/httpd/conf/httpd.conf.

You will need the statement Options +Includes there. This enables the so-called server side includes (SSI) which are used by the page the users read (which contain the actual content). This can be a security problem because whoever can edit these pages can run any command on your web server. (IncludesNOEXEC is not enough.) You might want to consider to enable this only for the directories where it is needed with <Directory> statements. See also the chapter on security .

In /etc/httpd/conf/httpd.conf, make sure these lines are not commented out:


AddType application/x-httpd-php3 .php3

and

AddType text/html .shtml
AddHandler server-parsed .shtml

"Commented out" means That they are prepended by a "#". Remove the leading "#" from the lines if it is there.

Add index.php3 to the tt/DirectoryIndex/ line:


DirectoryIndex index.html index.shtml index.cgi index.php3

Restart the web server to reread the configuration files:


# /etc/rc.d/init.d/httpd restart

After these configuration steps, PHP should work. You can test this by browsing to your test page ( http://localhost/test.php3) again.

3.7 PHPLIB installation

Get PHPLIB from http://sourceforge.net/projects/phplib. Unpack it, create a directory at the same level as your http conf directory and extract the files from phplib's php directory to the new directory: For example, if your configuration files are in /etc/httpd/conf then create /etc/httpd/phplib. ActionApps have been tested with version 7.2b and 7.2d of phplib.


% tar xvfz phplib-7.2d.tar.gz
% su
Password:
# mkdir /etc/httpd/phplib
# cp phplib-7.2d/php/* /etc/httpd/phplib/

You need to edit the php.ini (or php3.ini) to include phplib, and check one or two configuration lines, this file is typically either /etc/httpd/php.ini or /usr/local/lib/php.ini

Edit that file so the lines looks something like this:


include_path    =  /home/httpd/phplib:.:/usr/local/lib/php                 ; UNIX: "/path1:/path2"  Windows: "\path1;\path2"

allow_call_time_pass_reference = On

register_globals = On                 ; needed so that POST parameters end up in global variables
magic_quotes_gpc = On ; needed to avoid various bugs with untested code!

(The stuff beginning with the ";" is a comment.)

Restart the webserver to use the new php.ini file.


Next Previous Contents