IBM HTTP Server

ntroductionFor a number of years, IBM has been shipping the IBM HTTP Server Web server as part of the WebSphere Application Server package. In the WebSphere-centric world, most of the hard work is done in the WebSphere Application Servers by applications written in the Java™ language, and the job of the humble Web server is to sit in front of the application servers and serve up static content: static html pages, applets, and so on.

It turns out that IBM HTTP Server is a fully functional version of the Web’s most popular Web server, Apache, and is capable of serving more than static content. It is able to run modules written to Apache’s dynamic shared objects (DSO) interface and in particular, it can host and run applications written in PHP.

Discover the similarities and differences between open source Apache and the IBM HTTP Server and consider some reasons why you might prefer one to the other. Then, as a proof by example and to convince the skeptical, walk through the steps to get a representative and well-known open source PHP application, PHPNuke, running on IBM HTTP Server. To prove it is not a fluke, find out how to do it on both Windows™ and Linux™.

Back to top

What is the IBM HTTP Server? How does it differ from the open source Apache Web server?

First, the IBM HTTP Server is Apache. There are two versions of IBM HTTP Server, based in turn on 1.3 and 2.0 versions of open source Apache but with small alterations to allow IBM to attach extra features. The code bases are maintained inside IBM, where IBM keeps them up to date by selectively picking up and applying bug fixes from the open source Apache CVS repository. IBM gives fixes to security bugs a very high priority. Importantly for people wanting to use PHP on IBM HTTP Server, IBM ensures that IBM HTTP Server is fully compatible with open source Apache, so that modules that are compiled to run with Apache will run with IBM HTTP Server.

You can download IBM HTTP Server from the IBM HTTP Server home page, listed under Resources.

The best place to look for a complete list of the alterations and additions that IBM makes is either the IBM HTTP Server Web site, or InfoCenter, which is the technical information that comes with IBM HTTP Server itself. Here is a list of the main differences. Three of the most significant differences are discussed in the sections that follow.

Threading
IBM HTTP Server 2.0 is compiled multi-threaded, something which is an option for version 2.0 of the open source Apache Web server. Although this is not a problem for PHP itself, it can cause a problem for some non-thread-safe PHP extensions. This is discussed in more detail later.
Secure Sockets Layer
IBM HTTP Server contains secure sockets layer support built-in with IBM’s GSKit library. The usual open source choice is OpenSSL. The differences between GSKit and OpenSSL’s versions of SSL are discussed later.
LDAP
IBM HTTP Server can access an LDAP server to obtain user and group authentication for the Web server itself. This is intended for use in an environment where an administrator manages a number of Web servers and wants to maintain authentication information for the Web servers in a single place.
Performance
IBM HTTP Server contains two enhancements aimed at improved performance. The first of these is the “FastCache” accelerator, which on the Windows operating system and recently on AIX, improves response time by caching pages in kernel memory. The second enhancement is that IBM HTTP Server comes with FastCGI support built in. FastCGI is an open extension to the Common Gateway Interface; it defines a protocol to talk to persistent CGI programs via a socket. This potentially removes a considerable overhead from the use of CGI programs.
Documentation
As already mentioned, IBM HTTP Server comes with the InfoCenter, which is a comprehensive set of help pages, especially on the points where IBM HTTP Server differs from Apache: how to set up for use of SSL, how to set up for use of an LDAP server, and so on. The documentation is provided in ten languages.
Installation
IBM HTTP Server uses a Java-based InstallShield installer so that installation looks the same on various platforms. The installer comes with text in a number of languages, just like the InfoCenter. It can also be configured to run as a silent installation.
Source code
IBM does not ship the source code for IBM HTTP Server, just the binaries. This may be the biggest and most significant difference for some people, and is discussed later.
Back to top

Multi-threading, Apache 1.3 and Apache 2.0

If you have worked with Apache and PHP for a while then you will likely have come across the warning in the install documentation that states “Do not use Apache 2.0.x and PHP in a production environment neither on Unix nor on Windows.” In the PHP 5.0.2 package on the Windows system, this warning is to be found at line 745 in install.txt. It is worth understanding what the issues are here so that you can decide whether to use Apache 2.0 or for that matter IBM HTTP Server 2.0.

Apache 2.0 can be configured to run in one of two ways: threaded or non-threaded. When running as a threaded server, multiple threads of execution can be active in the server at the same time, generating the reply to more than one user at once. In principle, this makes the server more responsive and better able to take advantage of bigger hardware with more processors. It introduces a hazard however. All the various layers of software that the server calls must be safe to be called on behalf of more than user at the same time. Although the Web server itself, the PHP interpreter, and PHP extensions are all safe to be called this way, some PHP extensions make use of libraries written in other languages like C, and not all of these libraries are thread-safe.

You can find a pointer to an Apache Web page on the matter, with some more advice and a method for sometimes working out which C libraries your PHP extensions might be using, and which are thread-safe, in the Resources section.

In practice many people choose to sidestep the issues and do one of two things: they either use Apache 2.0 in its single-threaded mode, or they use Apache 1.3 which always runs single-threaded. Although there are some other differences between Apache 1.3 and 2.0, for example 2.0 has support for IPv6, by far the most significant difference is in this matter of threading, so remaining with a 1.3 server is not the drawback it might sound.

How does this play out for IBM HTTP Server? IBM builds IBM HTTP Server from Apache 2.0 in its threaded mode: faster but potentially unsafe with non thread-safe extensions. And since IBM does not ship the source code, and the choice of threading or non-threading is chosen at compile time, as an end-user you do not have the choice to recompile IBM HTTP Server 2.0 non-threaded. At the time of writing, though, IBM is shipping both 2.0- and 1.3-based versions of IBM HTTP Server, giving you the choice to use the single-threaded 1.3-based server.

Back to top

Secure Sockets Layer and GSKit

The Secure Sockets Layer (SSL) is the layer of software that permits secure and encrypted communications between the Web browser and the server. You know when your communication with the server is being carried over SSL when the URL of the Web site you are using starts with “https” and not “http”. In Internet Explorer, Netscape, or Mozilla, a small padlock appears somewhere in the status bar of the browser.

SSL is not only responsible for encrypting the data being carried between browser and server, but it can also be used to verify that the server you are connected to is indeed the Web site it claims to be, or for the user of the Web browser to verify that they are who they say they are.

IBM HTTP Server does not use the generally available open source implementation of SSL, OpenSSL, but uses instead IBM’s GSKit library. This library is used by a number of IBM products, and the cryptography routines are embedded in a subcomponent called IBM Crypto for C (ICC) which has been certified against Federal Information Processing Standards (FIPS) on a variety of platforms, making it suitable for use by some parts of the US Government. FIPS is specified by the US National Institute of Standards and Technology and the certification for ICC is available on the NIST site. A link to the certification, along with precise details of the tests performed, can be found in the Resources section.

In a nutshell, the version of SSL in IBM HTTP Server has been certified for use in some government applications.

Back to top

No source code

As mentioned above, IBM does not ship the source code for IBM HTTP Server, even though it is based on the open source Apache Web server. Instead, IBM supplies pre-compiled binaries for many common platforms and operating systems, both IBM and non-IBM: AIX, Sun Solaris, HP-UX, Linux (on a variety of hardware, including the zSeries®) and Windows. Distributing binaries and not source this way is quite in keeping with the Apache license under which the open source Apache Web server is distributed, by the way.

Whether having no source code comes as a blow or a blessed relief to you will probably depend on how you like to obtain service and support, documentation, and so on. If you like the open source model of support: freely available source code, support through newsgroups, blogs, community websites and so on, then you may dislike it. On the other hand if you are comfortable with the IBM support model: Redbooks, the IBM support Web sites, and IBM support personnel and processes, and you do not want to recompile the source code, then you will be comfortable with IBM HTTP Server. Note that while IBM HTTP Server is freely downloadable, IBM provides service and support for IBM HTTP Server only when it has been purchased as part of WebSphere.

Back to top

A working example: PHPNuke

That’s enough discussion of the differences between IBM HTTP Server and Apache. Next, learn how to get PHP running on IBM HTTP Server by installing PHPNuke, a well-known PHP application. It does not matter if you know the application. PHPNuke is a content management system, which is software that provides a community with a Web site to host news, Web logs, and so on.

This experiment was tried on Windows and Linux on a single-CPU Intel x86 machine. Windows XP and both Red Hat 9.0 and Red Hat Enterprise Linux version 3, Update 3 were used. IBM HTTP Server, PHP, MySQL, phpMyAdmin, and finally PHPNuke itself were installed. Each section offers instructions for Windows and Linux, with the steps clearly marked with a “W” or an “L”. The installations of IBM HTTP Server, PHP, and MySQL differ on Windows and Linux, but the installations of phpMyAdmin and PHPNuke are similar on both operating systems.

Getting started

Your first step is to gather software. The links from which you can download each of these can be found in the Resources section below.

On Windows, you used the following at the following levels:

  • IBM HTTP Server 2.0.47.1
  • PHP 5.0.3
  • MySQL 4.0.23
  • phpMyAdmin 2.6.0-pl3
  • PHPNuke 7.5

You downloaded each as a zip file. There are two possible downloads for MySQL: you downloaded the zip file that includes an installer.

On Linux, you used the following at the following levels:

  • IBM HTTP Server 6.0.0.0
  • PHP 5.0.3
  • MySQL 4.1.8
  • phpMyAdmin 2.6.0-pl3
  • PHPNuke 7.5

You will find the exact filenames of the Linux install files in the sections that follow.

The above were all current on the day they were downloaded (December 21, 2004). Although PHPNuke 7.6 was available, it costs a small amount of money, so 7.5 was chosen, which was the most recent free version.

You may choose to deviate from either of these lists. On Windows, there were problems using the more recent MySQL 4.1.7 instead of 4.0.22. These had to do with the MySQL client library that comes with PHP 5.0.2 not being happy to talk to MySQL 4.1.7. It gave a “1251” error suggesting the client library should be updated. Instead, MySQL 4.0 was chosen to make things easier. On Linux, as you see from the list above, the latest available levels of all the software were used with no problem.

Also, some parts of this scenario were tried using PHP 4.3.9, which worked fine. PHP 4 and 5 differ in their directory layout, otherwise it makes no difference to the scenario described here.

Your first step is to install IBM HTTP Server.

Installing and starting IBM HTTP Server

There are three steps here: unpacking the download, using the provided Java-based installer to perform the install, and starting IBM HTTP Server.

Depending on which version of IBM HTTP Server you are installing you may need a version of the Java runtime on your machine. IBM HTTP Server 6.0.0 comes with the Java installer embedded within it, whereas IBM HTTP Server 2.0.47.1 does not. If you are running on AIX or Linux and you need to download a copy of the Java runtime, you may find one freely downloadable from the IBM site (see Resources for link). On other operating systems, you may need to download one from elsewhere: the Sun JVM is an obvious choice. The IBM HTTP Server installer does not seem to be very sensitive to the version of the JVM.

The exact steps for Windows are:

Win.1 Unzip the IBM HTTP Server download.
Always unzip into C:\installs, so that you then find a setup.jar file in C:\installs\IHS-2.0.47.1\.
Win.2 Execute the install.
Once you have a JVM installed and in your path, you should locate the setup.jar and execute it as follows:

C:\installs\IHS-2.0.47.1>java -jar setup.jar

The install dialog will ask familiar questions:

  • choose the language for the install
  • accept the terms and conditions
  • specify or allow to default the directory to contain IBM HTTP Server
  • choose a setup type (Typical will do)
  • enter a userid and password under which it will run, since on Windows it will run as a service
Win.3 Start IBM HTTP Server.
You have three ways to start it now.

  1. Start a Command Prompt window, navigate to where IBM HTTP Server is installed and execute the Apache command directly, though this is probably not what you want to do each time.
  2. Look for it as a Windows Service and start it in Start -> Control Panel -> Administrative Tools -> Services.
  3. The third way, is to find ApacheMonitor.exe in C:\Program Files\IBM HTTP Server 2.0\bin and start this, which then displays as the Apache feather in the notification area of the Windows toolbar, in the bottom right hand corner of the screen. Once the ApacheMonitor is running you will be able to start, stop and restart IBM HTTP Server from here too.

The exact steps for Linux are:

Linux.1 Download and untar the install image.
Download the IBM HTTP Server 6.0 (ihs.6000.linux.ia32.tar) from the IBM HTTP Server Web site listed in the resources. Log on as root and untar the above file in your home directory. Always choose /root to untar into and the examples that follow will show this.
Linux.2 Locate the image and execute the install
Locate the install image and execute as follows, choosing the default values on all the screens.

[root@localhost /root] cd /root/IHS
[root@localhost /root/IHS] ./install
Linux.3 Start IBM HTTP Server
IBM HTTP Server installs by default into /opt/IBMIHS so start it with the apachectl command as follows:

[root@localhost /root] /opt/IBMIHS/bin/apachectl start

When you later want to restart or stop the server, use the apachectl command with “restart” or “stop”.

Connect to IBM HTTP Server and check the installation

The steps here use a browser to connect to IBM HTTP Server and read the documentation. This process is much the same on Windows and Linux.

Start a Web browser and go to the URL “http://localhost” to display the welcome page from IBM HTTP Server.

Figure 1. IBMS HTTP Server welcome screen
IHS welcome screen
The “View Documentation” link will take you to the InfoCenter pages where you can find out more about the extras that IBM has added to IBM HTTP Server. The InfoCenter does not display properly with the Windows version of Mozilla Firefox, unfortunately, but works fine with Internet Explorer. On Linux it displays fine with Mozilla.

Figure 2. IBM HTTP Server InfoCenter
IHS - View Documentation
Your next step will be to install MySQL.

Installing MySQL

The steps in this section cover installing MySQL, starting it, and setting the password for the root user. MySQL has many ways of achieving the same thing. Here are the commands to get MySQL configured and the PHPNuke database created in as few steps as possible. It may be that you have some experience with MySQL and know other ways of achieving the same thing, in which case please feel free to deviate from the steps listed here. The installation process is quite different between Windows and Linux.

On Windows the exact steps are:

Win.1 Unzip and install
MySQL comes with a Windows installer so it is recommended you start there by unzipping the download and executing setup.exe. The only questions asked during the install for 4.0.23 are the basics: where to install (default location is C:\mysql) and install type — Typical is fine. If you experiment with 4.1, you will find the installer asks more questions and does more during installation.
Win.2 Install MySQL as a service and start it.
Install MySQL as a Windows service to start automatically. First, you need a command window from which to run the MySQL executables. Open a command window in C:\mysql\bin.

C:\mysql\bin>mysqld-nt --install

Go to the Windows Services window (Start -> Control Panel -> Administrative Tools -> Services), find MySQL and start it.

Win.3 Set the password for the root user
Assuming you are connected to a network, you might want to set a password to control access. Once started, MySQL is listening on a socket for connections. Here set the password for the userid “root” to the rather poorly chosen password “root” (only one step better than password “password”!).This is not a recommended password! You will use whatever password you choose later.Another consideration is that in the steps that follow you might not wish to use the MySQL user root, but create one especially for the use of phpMyAdmin and PHPNuke. That’s fine. Choose root since it is there by default.

Note that this userid “root” is not a Windows userid but private to MySQL — more like a user administration role.

The precise interaction — starting the mysql command line client, and entering the command to set the password for connections from the local machine — looks like this:

C:\mysql\bin>mysql -u root
Welcome ... [text omitted]
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root');
Query OK, 0 rows affected (0.00 sec)
mysql>quit
Bye
C:\mysql\bin>

On Linux the exact steps are:

Linux.1 Download the install images
Download MySQL 4.1.8 for i386 platform from the MySQL Web site listed in the resources section. You will need to download the following files:

  • MySQL-server-4.1.8-0.i386.rpm
  • MySQL-shared-4.1.8-0.i386.rpm
  • MySQL-devel-4.1.8-0.i386.rpm
  • MySQL-client-4.1.8-0.i386.rpm
Linux.2 Install MySQL binaries
Log on as root and place all the above files in your home directory, say /root. Change directory to /root and execute the rpm command to install all four packages.

[root@localhost /root] rpm -ivh MySQL-*
Linux.3 Start MySQL server
There are many ways to start the MySQL server. It is usually started from the command line, using either of the following two commands:

[root@localhost /root] /etc/init.d/mysql start

or

[root@localhost /root] service mysql start

If you later want to stop it then you can use either of the same commands with the option “stop”.

Linux.4 Set the password for the root user
Assuming you are connected to a network, you might want to set a password to control access, as once started, MySQL is listening on a socket for connections. In the examples here set the password for the MySQL user “root” to the rather poorly chosen password “root” (only one step better than password “password”!). Note that this userid “root” is not in any way related to the Linux root userid but private to MySQL — more like a user administration role. It is not recommended to use “root” as the password! You will use whatever password you choose later.Another consideration is that in the steps that follow you might not wish to use the MySQL user root, but create one specially for the use of phpMyAdmin and PHPNuke. That’s fine. Choose root since it is there by default.

Set the password as follows:

[root@localhost /root] mysqladmin -u root password root

Installing PHP and linking IBM HTTP Server and PHP together

The steps here differ substantially between Windows and Linux because on Windows you use a pre-compiled binary, whereas on Linux you configure and compile the PHP interpreter. The aim is the same in both cases: to create and populate the PHP directory structure, to configure an appropriate php.ini configuration file, and to configure IBM HTTP Server so that it runs files with a .php extension through the PHP interpreter.

On Windows the steps are:

Win.1 Unzip the PHP install.
Begin by unzipping the downloaded PHP zipfile. There is no installer and you can choose whereabouts the php directory should go. Stick with the traditional C:\php.
Win.2 Create php.ini.
You need to select a php.ini file from one of the two supplied: php.ini-dist or php.ini-recommended. There is some discussion of the difference between the two in the C:\php\install.txt file, which says that the latter has better performance and security. Take a copy of C:\php.ini-recommended and name it C:\php\php.ini.
Win.3 Place directives in httpd.conf
You now need to add three lines to the IBM HTTP Server config file so that IBM HTTP Server can find PHP, load the PHP module, and associate the file extension .php with the PHP interpreter.Assuming you installed IBM HTTP Server in the default place, the IBM HTTP Server config file will be in C:\Program Files\IBM HTTP Server 2.0\conf\httpd.conf and the three lines you need to add are:

PhpIniDir c:/php
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

Note the forward slashes in the otherwise normal Windows directory and file names: they are correct. You can be tidy and put the statements in their proper place within the config file but it works just as well to cut and paste them in as a unit and keep them all together. Put them as a unit just before the first of the other LoadModule statements. You will need to edit the PhpIniDir directive if you have put PHP anywhere other than C:\php.

Win.4 ensure php5ts.dll can be found
You’ll also need to ensure that Windows can find and load an essential PHP DLL using the normal Windows DLL loading process. The DLL in question is C:\php\php5ts.dll (the ts stands for thread-safe) and you have two ways to get it picked up — you can put C:\php in your PATH, or you can copy C:\php\php5ts.dll to the same directory as the IBM HTTP Server executable, which is C:\Program Files\IBM HTTP Server 2.0\bin. Within our group, opinions are split about which is the better method!
Win.5 Restart IBM HTTP Server to pick up the changes.
Now restart IBM HTTP Server. You can do this from Start -> Control Panel -> Administrative Tools -> Services, or using the ApacheMonitor.

On Linux the exact steps are:

Linux.1 Download and untar
Download the PHP 5.0.3 sources (php-5.0.3.tar.bz2) from the link provided in the resources section and untar as follows:

[root@localhost /root] tar -xjvf php-5.0.3.tar.bz2
Linux.2 Configure and compile the source
Change directory to php-5.0.3 and configure and compile the sources with the following four options as shown. This is all one command that has been laid out for readability. Compiling may take several minutes depending on your machine processor, memory and etc.

[root@localhost /root/php-5.0.3] ./configure --with-apxs2=/opt/IBMIHS/bin/apxs 
                                 --with-mysql=/usr  
                                 --with-config-file-path=/opt/IBMIHS/conf 
                                 --enable-maintainer-zts
[root@localhost /root/php-5.0.3] make

The final option, –enable-maintainer-zts, causes the PHP interpreter to be compiled to run safely with a threaded Web server like IBM HTTP Server: “zts” stands for Zend Thread Safe or something like it. Note you will need to recompile. If you do manage to find and download a pre-compiled PHP for Linux it will likely not have been compiled with thread-safety on, and when IBM HTTP Server loads the PHP interpreter, it does check, and will issue an error message if the PHP has been compiled in a way that is thread-safe.

Linux.3 Copy the PHP shared library
Copy the built module into the IBM HTTP Server modules directory.

[root@localhost /root/php-5.0.3] cp .libs/libphp5.so /opt/IBMIHS/modules
Linux.4 Create php.ini
You need to select a php.ini file from one of the two supplied: php.ini-dist or php.ini-recommended. There is some discussion of the difference between the two in the install.txt file, which says that the latter has better performance and security. Copy the php.ini-recommended to IBM HTTP Server Configuration directory as php.ini.

[root@localhost /root/php-5.0.3] cp php.ini-recommended /opt/IBMIHS/conf/php.ini
Linux.5 Place directives in httpd.conf
Add the following lines into IBM HTTP Server’s httpd.conf (if you installed IBM HTTP Server at the default location, this file is available at /opt/IBMIHS/conf/httpd.conf) by opening the same into your favorite editor. You can add these lines anywhere you wish, but preferably add these lines immediately after all the LoadModule statements in the above file are:

LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps
Linux.6 Restart IBM HTTP Server to pick up the changes.
Now restart IBM HTTP Server.

[root@localhost /root] /opt/IBMIHS/bin/apachectl restart

The next step is to get a PHP page displayed.

Check the PHP installation

The steps here are to create a page that uses PHP and to display it. Only the location of the page, not the content, differs between Windows and Linux.

You may have a PHP page, but if not then you will find you get a lot of output for very little effort with the following complete-as-it-stands PHP script:

<? echo phpinfo(); ?>

Insert this line, all 21 characters of it, into a file called test.php and place this file where IBM HTTP Server can find and load it. See below for the correct location for the file.

Win.1 Locate the test.php file on Windows.
If you installed IBM HTTP Server with English as the default language, this will be in the directory C:\Program Files\IBM HTTP Server 2.0\htdocs\en_US. If you installed IBM HTTP Server with a different default language, then the final part of the directory name will specify a different language. In either case, the directory to place it is that specified by the DocumentRoot directive in the IBM HTTP Server config file, C:\Program Files\IBM HTTP Server 2.0\conf\httpd.conf.
Linux.1 Locate the test.php file on Linux.
If you installed IBM HTTP Server with English as the default language this will be in the directory /opt/IBMIHS/htdocs/en_US. If you installed IBM HTTP Server with a different default language then the final part of the directory name will specify a different language. In either case, the directory to place it is that specified by the DocumentRoot directive in the IBM HTTP Server config file, /opt/IBMIHS/conf/httpd.conf.

Now start a browser and direct it to http://localhost/test.php. With luck you will see a screen like that below.

Figure 3. Output from test.php script
phpinfo()
If you don’t see the phpinfo screen above then the two most likely other things you might see are:

  • A screen containing the php text you typed in: <? echo phpinfo(); ?>. We saw this when we forgot to restart IBM HTTP Server and so IBM HTTP Server had not picked up the changes we had made to httpd.conf, and therefore did not recognize the file extension .php as meaning that the file should be run through the PHP interpreter.
  • A completely blank screen (although if you view the source of the page it does contain some HTML tags, just no visible content). We saw this when we had made a mistake in entering the test.php script. In this case we found that there was a useful error message containing the text “…PHP Parse error: syntax error in … test.php” in the IBM HTTP Server error log file, which on Windows will be found in C:\Program Files\IBM HTTP Server 2.0\logs\error.log, and on Linux in /opt/IBMIHS/logs/error.log.You may consider that this message would be more useful if written back to the browser window, but this is a deliberate consequence of choosing php.ini-recommended file and not php.ini-dist as the basis for the php.ini file. It is considered a benefit to security that errors are written to the error log and not the browser, and hence nothing is given away about the setup on the server. If you want the messages to be sent back to the browser then use php.ini-dist as the basis for your php.ini.

If you have got this far you have a working IBM HTTP Server and PHP system and are ready to configure PHP to talk to MySQL.

Configuring PHP to access MySQL

Here the steps are to ensure that PHP can find the MySQL libraries. This is only needed for Windows. On Linux, the linkage was created when the PHP interpreter was compiled.

For Windows only:

Win.1 Configure the php.ini file so PHP can find MySQL
Now you have to make sure that PHP knows how to find and load the PHP extension that will let it talk to MySQL. Edit your php.ini file and do the following:Look for the line that specifies the php_mysql.dll extension and uncomment it by removing the semicolon. After uncommenting, the lines in the vicinity look like this in our php.ini:

;extension=php_msql.dll
extension=php_mysql.dll
;extension=php_oci8.dll

Make sure the PHP extension can be found by setting the extension_dir variable correctly. A little higher up the file you should see this variable, set by default to “./”. Change this to point to the extensions directory in your installation of php as follows:

extension_dir = "c:\php\ext"
Win.2 Ensure the MySQL DLL can be loaded.
The other half of the PHP to MySQL connection is the MySQL library libmysql.dll that is provided in C:\php\ext. When starting IBM HTTP Server, Windows is going to need to load this using its usual DLL loading procedure. As before, you have a choice: You can add C:\php\ext to your PATH or you can copy the DLL to directory containing the IBM HTTP Server executable, C:\Program Files\IBM HTTP Server 2.0\bin.
Win.3 Restart IBM HTTP Server
You now have to restart IBM HTTP Server so PHP can re-read the php.ini file.Unfortunately, it is all too easy to make a mistake in these final steps. If you get the message “Unable to load dynamic link library…php_mysql.dll” it will be because of this. It is hard to give clearer advice but one thing to remember is that although the message mentions php_mysql.dll it may in fact be failing because it cannot find libmysql.dll.

Installing phpMyAdmin

The steps here are to unpack the phpMyAdmin PHP code into a place where it can be loaded by IBM HTTP Server, and to specify the MySQL root password that you set in the previous step in the phpMyAdmin config file.

It is not strictly necessary to install phpMyAdmin, but it is a very useful way to test the connection between PHP and MySQL, and it is likely that you will want it in due course anyway. Because the phpMyAdmin is a PHP application, the code is the same on Windows as it is on Linux. Only the location into which the files must be placed differ.

On Windows:

Win.1 Unpack the phpMyAdmin code
Unzip the phpMyAdmin zip file and copy the contents to a directory where IBM HTTP Server can find it: as before if you installed IBM HTTP Server with English as the default language it will be C:\Program Files\IBM HTTP Server 2.0\htdocs\en_US else one where the final part of the directory name is different. Copy it and rename it without the 2.6.0-pl3 in the directory name so that the precise directory structure we ended up with had a file C:\Program Files\IBM HTTP Server 2.0\htdocs\en_US\phpMyAdmin\index.php.
Win.2 Enter the MySQL root password in phpMyAdmin config file.
You now need to edit the phpMyAdmin configuration file so that it knows the root password for MySQL that you entered in an earlier step:Edit C:\Program Files\IBM HTTP Server 2.0\htdocs\en_US\phpMyAdmin\config.inc.php, and near line 84, you should find the lines specifying the root userid and password. The relevant section of our file looks like this, with the added password highlighted:

$cfg['Servers'][$i]['auth_type']     = 'config';    // ...
$cfg['Servers'][$i]['user']          = 'root';      // ...
$cfg['Servers'][$i]['password']      = 'root';       // ...
                                                    // ...

On Linux:

Linux.1 Download and unpack the phpMyAdmin code
Download the phpMyAdmin ( phpMyAdmin-2.6.0-pl3.tar.bz2) from the link available in the resources and untar it into the IBM HTTP Server htdocs directory as follows. As before, if you installed IBM HTTP Server with English as the default language it will be /opt/IBMIHS/htdocs/en_US, else one where the final part of the directory name is different.

[root@localhost /opt/IBMIHS/htdocs/en_US] tar -xjvf /root/phpMyAdmin-2.6.0-pl3.tar.bz2

We renamed it without the 2.6.0-pl3 in the directory name so that the precise directory structure we ended up with had a file /opt/IBMIHS/htdocs/en_US/phpMyAdmin/index.php.

Linux.2 Enter the MySQL root password in phpMyAdmin config file.
You now need to edit the phpMyAdmin configuration file so that it knows the root password for MySQL that you entered in the previous step:Edit /opt/IBMIHS/htdocs/en_US/phpMyAdmin/config.inc.php, and near line 84 you should find the lines specifying the root userid and password. The relevant section of our file looks like this, with the added password highlighted:

$cfg['Servers'][$i]['auth_type']     = 'config';    // ...
$cfg['Servers'][$i]['user']          = 'root';      // ...
$cfg['Servers'][$i]['password']      = 'root';       // ...
                                                    // ...

You should now be able to connect to http://localhost/phpMyAdmin/index.php. With luck, you will see the following screen:

Figure 4. phpMyAdmin initial screen
phpMyAdmin screen
There are two other likely possibilities for what you might see. These are both problems that only occurred for us on Windows:

  • If you are unlucky, you will see the message beginning with the code 1251 and you have fallen foul of the problem that we had running MySQL 4.1 against PHP 5.0.3 on Windows. You will recall that we fell back to MySQL 4.0 for this reason.
  • A screen with the message “cannot load mysql extension”. This will occur if PHP is unable to find and load the PHP to MySQL extension. This can be a defect in the php.ini file or because Windows is unable to find one of the MySQL library files, php_mysql.dll or libmysql.dll. Please look again at the final paragraphs of the section on Configuring PHP to access MySQL above.

You are ready for the final step: install PHPNuke.

Installing PHPNuke

The steps here are to unpack the PHPNuke code into a place where it can be loaded by IBM HTTP Server, to create the PHPNuke database and tables in MySQL, and to specify the MySQL root password in the PHPNuke config file.

The exact steps on Windows:

Win.1 Unpack the PHPNuke code
First step is to unzip the zipfile and copy part of the contents into the appropriate place. The unzipped version contains a directory html, which is the executable PHP part of PHPNuke. We copied this html directory into IBM HTTP Server’s htdocs directory and renamed it to “nuke”, so that we had the file C:\Program Files\IBM HTTP Server 2.0\htdocs\en_US\nuke\index.php
Win.2 Create the PHPNuke database and tables
Now you need to create the PHPNuke database in MySQL. Since you have to use mysql to create the tables we might as well create the database using mysql although you could just as easily do so using phpMyAdmin.The following commands will prompt you for the MySQL root password that you specified before. You also need to know where to find the file containing sql commands that will create the PHPNuke tables. This file is also in the unzipped install directory. We unzipped PHPNuke into C:\installs, so that we had a file C:\installs\phpnuke\sql\nuke.sql. This is the file you need.

The interaction with MySQL to create the database and execute the commands to create the PHPNuke tables looks as follows:

C:\mysql\bin>mysql -u root -p 
Enter password: ****
Welcome....[text omitted]
mysql> create database nuke;
Query OK, 1 row affected (0.00 sec)
mysql> use nuke;
Database changed
mysql>source C:\installs\phpnuke\sql\nuke.sql
[string of Query OK messages]
mysql>exit
Bye
C:\mysql\bin>
Win.3 Configure PHPNuke to know MySQL root password
The last thing to do is to let PHPNuke know the password you specified when you installed MySQL so that it can access the nuke database you just created. The password is specified in config.php, which you will find in the same directory with PHPNuke’s other PHP files, which for us was C:\Program Files\IBM HTTP Server 2.0\htdocs\en_US\nuke. Change the assignment to the $dbpass variable as shown by the highlighted change below:

$dbhost = "localhost";
$dbuname = "root";
$dbpass = "root";
$dbname = "nuke";
$prefix = "nuke";

The exact steps on Linux:

Linux.1 Download and unpack the PHPNuke code
Download PHPNuke 7.5 (PHP-Nuke-7.5.zip) into /root, then create a directory called nuke in /opt/IBMIHS/htdocs/en_US, cd to it, and unzip the download directly in there:

[root@localhost /opt/IBMIHS/htdocs/en_US/nuke] unzip /root/PHP-Nuke-7.5.zip
Linux.2 Create the PHPNuke database and tables
Now you need to create the PHPNuke database in MySQL. Since you have to use mysql to create the tables, we might as well create the database using mysql although you could just as easily do so using phpMyAdmin.The following commands need you to include the MySQL root password that you specified before. You also need to know where to find the file containing sql commands that will create the PHPNuke tables. This file is also in the untarred install directory. We untarred PHPNuke under IBM HTTP Server’s htdocs directory so that the SQL commands will be found in /opt/IBMIHS/htdocs/en_US/nuke/sql/nuke.sql.

The interaction with MySQL to create the database and execute the commands to create the PHPNuke tables looks as follows:

[root@localhost /opt/IBMIHS/htdocs/en_US/nuke] mysql --user=root --password=root
mysql> create database nuke;
mysql> use nuke;
mysql> source /opt/IBMIHS/htdocs/en_US/nuke/sql/nuke.sql
Linux.3 Configure PHPNuke to know MySQL root password
The last thing to do is to let PHPNuke know the password you specified when you installed MySQL, so that it can access the nuke database you just created. The password is specified in config.php which you will find in the same directory with PHPNuke’s other PHP files, which for us was /opt/IBMIHS/htdocs/en_US/nuke. Change the assignment to the $dbpass variable as shown by the highlighted change below:

$dbhost = "localhost";
$dbuname = "root";
$dbpass = "root";
$dbname = "nuke";
$prefix = "nuke";

If you use phpMyAdmin to browse the database you should be able to see the tables created.

Figure 5. PHPNuke tables in phpMyAdmin
PHPNuke tables in phpMyAdmin
If that is all in place then you should be ready to go to the initial page of the PHPNuke site you have just installed and initialized. Go to http://localhost/nuke/index.php and you should see:

Figure 6. PHPNuke initial screen
PHPNuke initial screen
If you do not see this then you may instead see a screen saying “There seems to be a problem with the MySQL server, …” We saw this when we had not correctly specified the database password in the config.php file, as described just a few lines above.

At this point, you may want to check that the site is functioning correctly by creating a userid and posting news on the site, and you will find a tutorial describing how to do so on PHPNuke’s home page itself. This is the point though that having proved the point that PHPNuke will install and run on IBM HTTP Server, this article stops.

Leave a comment