Setting Up OpenAdmin Tool
(OAT) on Mac OS
Introduction
The Open Admin Tool (OAT) is an open source web-based
administration tool for Informix Dynamic Server (IDS). It is a web console
where users can manage dbspaces, schedule tasks and monitor
MACH 11 clusters etc. through their web browsers.
OAT is a web console that is hosted on a single web server.
Other machines that have access to the web server’s network can simply open up
a web browser, type in the web server machine’s URL, and they can use OAT to
manage their database servers.
In order to host the Open Admin Tool website, the following
prerequisites have to be setup:
- Informix
Client SDK or Informix Connect
- A web
server, such as Apache 2.0.
- PHP
5.2.4 dynamically loaded as an Apache 2.0 module. It also has to have the
following extensions enabled
- Pcre
- Pdo
- Pdo_sqlite
- Pdo_informix
- Soap
- Gd (requires libpng and libjpeg
libraries)
- Openssl (requires libssl and libcrypto
libraries)
- Sockets
- Libxml (requires libxml2 libraries)
- Session
- Simplexml
The Open Admin Tool can be hosted on any platforms that have
all of the above setup.
This article will provide the steps on how to setup OAT on a
Mac OS X Platform.
Setting up Open Admin Tool (OAT) on Mac OS
First step is to install Informix Client SDK for Mac OS.
The Mac OS will already have an Apache web server installed.
We can use the Apache web server that comes with Mac OS. We do not need to
install other web servers.
The Mac OS will also have an installed PHP,
however the PHP that comes with Mac OS does not have all the extensions that
OAT requires. We cannot use the PHP that comes with Mac OS. We have to compile
PHP binaries from source.
Our goal here is to build our own PHP binaries and
dynamically load it to the Apache web server that comes with Mac OS.
Compiling PHP on Mac OS
Before starting to compile PHP, make sure that you have
libpng, libjpeg, openssl and libxml2 installed into /usr/local/ or /usr/. Some PHP extensions require these libraries in order
to compile.
Obtain the latest PHP source code from php.net (http://www.php.net/downloads.php).
Decompress the source code package and issue the following commands.
cd /path/to/php/source/code
./configure --prefix=/path/to/where/you/want/to/install/php
--with-apxs2=/usr/sbin/apxs --enable-soap --enable-pdo --with-pdo-sqlite
--with-gd --with-pcre-regex --enable-session --with-openssl --enable-sockets
--enable-libxml --enable-simplexml
make
The “configure” command will generate a makefile specific to
your machine’s build environment. The “make” command will use the generated
makefile to create PHP binaries.
The “configure” and “make” command will not always run
smoothly. It is dependent on your machine’s setup. Please see the following
section about debugging the “configure” command for more information.
If the “configure” and “make” command ran smoothly, you can
run the “make install” command. This command will copy the php binaries to
/path/to/where/you/want/to/install/php. It will also overwrite the PHP apache
handler (the glue between Apache and PHP, called libphp5.so) at /usr/libexec/apache2/.
You may want to backup the Mac OS’s default libphp5.so before running “make
install”
##Be sure that you have
backed up /usr/libexec/apache2/libphp5.so##
make install
After the “make install” command, the php binaries can be
found under /path/to/where/you/want/to/install/php/.
Right now we have compiled the PHP binaries that have all
the extension modules that OAT requires, EXCEPT the pdo_informix extension.
This extension DOES NOT come with PHP source code from php.net. We have to
compile it from source code separately from PHP, and enable it as a dynamic PHP
extension module. We will go through the process of compiling pdo_informix in
the later section “Compiling pdo_informix extension and enabling it in PHP”.
Right now we also have compiled the PHP apache handler (the
glue between PHP and apache). This will appear as a file called “libphp5.so”,
under /usr/libexec/apache2/. This file will be loaded as a dynamic Apache
module. This will be described in the later section “Enabling PHP in Apache”
The next thing you have to do is to create a php
configuration file. Copy the sample php.ini file from
/path/to/php/source/code/php.ini-dist to /path/to/where/you/installed/php/lib
cd /path/to/php/source/code/
cp ./php.ini-dist
/path/to/where/you/want/to/install/php/lib/php.ini
Then edit the php.ini file. Make the following changes to
the php.ini file.
memory_limit = 128M Change
this to à memory_limit
= 300M
extension_dir =
"./" Change
this to à extension_dir =
“/path/to/where/you/installed/php/lib/extensions”
OAT requires a greater memory limit. Thus we increased the
memory limit here.
The extension_dir is the directory where dynamic PHP
extension modules will reside. Dynamic PHP extensions have to be placed under
extension_dir, and enabled in the php.ini configuration file. The pdo_informix
extension module will be handled in this fashion.
Debugging Information about the “configure” and “make”
command
The --prefix tag lets you specify where you want to install
the php binaries. You have to make sure that you have the write permissions to
that directory before configuring PHP.
The --with-apxs2 tag lets you specify where to find your
apache binaries, so that the apache handler (i.e. the glue between Apache and
PHP) can be built. This apache handler will appear as a file called
“libphp5.so” after the compilation. It will appear under /usr/libexec/apache2/.
This document will talk about how to dynamically load this handler to the
Apache web server in the later section “Enable PHP in Apache”. Here we are
using the Mac OS default Apache web server, thus this flag should be set to
point to /usr/sbin/apxs.
The --enable and --with flags specify what extensions you
want to enable. Pdo_informix will be enabled separately after we compile the
PHP binaries.
The “configure” and “make” command will not always run
smoothly. One possible reason is that the prerequisite libraries are not
present. For example, the php gd extension will not compile if libpng and
libjpeg libraries are not found on your machine. The openssl extension will not
compile if libssl and libcrypto libraries are not found. The libxml extension
will not compile if libxml2 libraries are not found. Make sure that you have libpng, libjpeg, openssl and libxml2 installed into /usr/local/
or /usr/ before running the configure command.
Another possible reason is that the library architecture and
the compilation flag do not match. If your libpng, libjpeg, libssl, libcrypto and libxml libraries
are in 32bit mode, you have to set the compilation flag CFLAGS to –m32. If your
libraries are in 64bit mode, you have to set CFLAGS to –m64. For example, if
you want to see whether your libxml2 library is 32bit/64bit, run the following
commands:
cd /usr/lib
file
libxml2.2.dylib
##If your libraries are
64bit, set CFLAGS to be –m64##
setenv CFLAGS –m64
##If your libraries are
32bit, set CFLAGS to be –m32##
setenv CFLAGS –m32
If you encounter problems, you can look into the config.log file generated by the configure script. You can
also open up the configure script (i.e. /path/to/php/source/code/configure)
or the makefile (i.e. /path/to/php/source/code/Makefile)
with a text editor, search for the error message and debug the problem. Sometimes
the configure script cannot find libraries because they are not installed on /usr/ or /usr/local/. In that
case, hardcoding your library paths to the configure
script’s library search path will solve the problem.
You may also add the --disable-all tag to the configure
command. This will disable all other extensions that we did not specify in the
configure command. Compiling fewer extensions will give us fewer errors. Since
OAT doesn’t require those extra extensions, it is okay to add the --disable-all
flag.
Compiling PDO_INFORMIX extension and enabling it in
PHP
Download the latest pdo_informix
source code from http://pecl.php.net/package/PDO_INFORMIX
Before you compile pdo_informix.
Make sure that CFLAGS are set accordingly. If your Client SDK/IConnect libraries are 32bit, then set CFLAGS to be –m32.
If your Client SDK/IConnect libraries are 64bit, then
set CFLAGS to be –m64
Decompress the pdo_informix source
code and run the following commands
cd /path/to/pdo_informix/source/code/
/path/to/where/you/installed/php/bin/phpize
./configure
--with-php-config=/path/to/where/you/installed/php/bin/php-config
–with-pdo-informix=/path/to/where/you/installed/ClientSDK/or/IConnect/
make
This compiles the pdo_informix
extension module. It will appear as a file “pdo_informix.so”
under /path/to/pdo_informix/source/code/modules/
Copy pdo_informix.so to the PHP extension_dir ( We have set this
to be /path/to/where/you/installed/php/lib/php/extensions/
in previous sections)
cd /path/to/pdo_informix/source/code/modules/
cp
./pdo_informix.so /path/to/where/you/installed/php/lib/php/extensions/
Add the following line to the php.ini configuration file (Under
/path/to/where/you/installed/php/lib/php.ini)
extension=pdo_informix.so
This will enable the pdo_informix
extension in PHP.
Enabling PHP in Apache
After PHP has been built successfully, the PHP apache
handler (the glue between PHP and apache) will be created. This will appear as
a file called “libphp5.so”, under /usr/libexec/apache2/
We have to edit the Apache
configuration file (httpd.conf) to load the
libphp5.so. This can be done by adding the following three lines in
/etc/apache2/httpd.conf. These lines might already exist in the httpd.conf but are commented out. In that case you only
have to uncomment them.
LoadModule
php5_module libexec/apache2/libphp5.so
AddType
application/x-httpd-php .php
AddType
application/x-httpd-php-source .phps
You also have to setup the Apache
environment variables. You will have to edit the /usr/sbin/envvars
file. Add the following lines in the envvars file.
INFORMIXDIR=”/path/to/IConnect/or/CSDK/installation/”
export
INFORMIXDIR
PATH=”$INFORMIXDIR/bin:$PATH”
export
PATH
DYLD_LIBRARY_PATH=”$INFORMIXDIR/lib:
$INFORMIXDIR/lib/cli: $INFORMIXDIR/lib/esql: $INFORMIXDIR/incl:
$INFORMIXDIR/incl/cli: $INFORMIXDIR/incl/esql: /usr/lib:
$DYLD_LIBRARY_PATH”
export
DYLD_LIBRARY_PATH
You may now start the Apache
web server. Issue the following command with root user access permissions.
/usr/sbin/apachectl
–f /etc/apache2/httpd.conf –k start
Unpack
OAT source code at /Library/WebServer/Documents/OpenAdminTool.
The ownership of all files under this directory has to be changed too. Make
sure these files are owned by the user and group that runs
apache. (These should match the user and group settings in
/etc/apache2/httpd.conf)
Visit
http://<hostname>.<domainname>//OpenAdminTool/index.php and
continue with the OAT web install. OAT should be operational after the OAT web
install.
Leo Chan