Setting Up OpenAdmin Tool(OAT) on Mac OS
The Open Admin Tool (OAT) is an open source web-basedadministration tool for Informix Dynamic Server (IDS). It is a web consolewhere users can manage dbspaces, schedule tasks and monitorMACH 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 upa web browser, type in the web server machine’s URL, and they can use OAT tomanage their database servers.
In order to host the Open Admin Tool website, the followingprerequisites 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
- Gd (requires libpng and libjpeg libraries)
- Openssl (requires libssl and libcrypto libraries)
- Libxml (requires libxml2 libraries)
The Open Admin Tool can be hosted on any platforms that haveall of the above setup.
This article will provide the steps on how to setup OAT on aMac 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 toinstall 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 thatOAT requires. We cannot use the PHP that comes with Mac OS. We have to compilePHP binaries from source.
Our goal here is to build our own PHP binaries anddynamically 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 havelibpng, libjpeg, openssl and libxml2 installed into /usr/local/ or /usr/. Some PHP extensions require these libraries in orderto 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.
./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
The “configure” command will generate a makefile specific toyour machine’s build environment. The “make” command will use the generatedmakefile to create PHP binaries.
The “configure” and “make” command will not always runsmoothly. It is dependent on your machine’s setup. Please see the followingsection about debugging the “configure” command for more information.
If the “configure” and “make” command ran smoothly, you canrun 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 apachehandler (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 “makeinstall”
##Be sure that you havebacked up /usr/libexec/apache2/libphp5.so##
After the “make install” command, the php binaries can befound under /path/to/where/you/want/to/install/php/.
Right now we have compiled the PHP binaries that have allthe extension modules that OAT requires, EXCEPT the pdo_informix extension.This extension DOES NOT come with PHP source code from php.net. We have tocompile it from source code separately from PHP, and enable it as a dynamic PHPextension module. We will go through the process of compiling pdo_informix inthe later section “Compiling pdo_informix extension and enabling it in PHP”.
Right now we also have compiled the PHP apache handler (theglue 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 Apachemodule. This will be described in the later section “Enabling PHP in Apache”
The next thing you have to do is to create a phpconfiguration file. Copy the sample php.ini file from/path/to/php/source/code/php.ini-dist to /path/to/where/you/installed/php/lib
Then edit the php.ini file. Make the following changes tothe php.ini file.
memory_limit = 128M Changethis to à memory_limit= 300M
extension_dir ="./" Changethis to à extension_dir =“/path/to/where/you/installed/php/lib/extensions”
OAT requires a greater memory limit. Thus we increased thememory limit here.
The extension_dir is the directory where dynamic PHPextension modules will reside. Dynamic PHP extensions have to be placed underextension_dir, and enabled in the php.ini configuration file. The pdo_informixextension 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 installthe php binaries. You have to make sure that you have the write permissions tothat directory before configuring PHP.
The --with-apxs2 tag lets you specify where to find yourapache binaries, so that the apache handler (i.e. the glue between Apache andPHP) 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 theApache web server in the later section “Enable PHP in Apache”. Here we areusing the Mac OS default Apache web server, thus this flag should be set topoint to /usr/sbin/apxs.
The --enable and --with flags specify what extensions youwant to enable. Pdo_informix will be enabled separately after we compile thePHP binaries.
The “configure” and “make” command will not always runsmoothly. One possible reason is that the prerequisite libraries are notpresent. For example, the php gd extension will not compile if libpng andlibjpeg libraries are not found on your machine. The openssl extension will notcompile if libssl and libcrypto libraries are not found. The libxml extensionwill 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 andthe compilation flag do not match. If your libpng, libjpeg, libssl, libcrypto and libxml librariesare in 32bit mode, you have to set the compilation flag CFLAGS to –m32. If yourlibraries are in 64bit mode, you have to set CFLAGS to –m64. For example, ifyou want to see whether your libxml2 library is 32bit/64bit, run the followingcommands:
##If your libraries are64bit, set CFLAGS to be –m64##
setenv CFLAGS –m64
##If your libraries are32bit, 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 canalso 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. Sometimesthe configure script cannot find libraries because they are not installed on /usr/ or /usr/local/. In thatcase, hardcoding your library paths to the configurescript’s library search path will solve the problem.
You may also add the --disable-all tag to the configurecommand. This will disable all other extensions that we did not specify in theconfigure command. Compiling fewer extensions will give us fewer errors. SinceOAT doesn’t require those extra extensions, it is okay to add the --disable-allflag.
Compiling PDO_INFORMIX extension and enabling it inPHP
Download the latest pdo_informixsource 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, thenset CFLAGS to be –m64
Decompress the pdo_informix sourcecode and run the following commands
This compiles the pdo_informixextension 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 thisto be /path/to/where/you/installed/php/lib/php/extensions/in previous sections)
Add the following line to the php.ini configuration file (Under/path/to/where/you/installed/php/lib/php.ini)
This will enable the pdo_informixextension in PHP.
Enabling PHP in Apache
After PHP has been built successfully, the PHP apachehandler (the glue between PHP and apache) will be created. This will appear asa file called “libphp5.so”, under /usr/libexec/apache2/
We have to edit the Apacheconfiguration file (httpd.conf) to load thelibphp5.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 onlyhave to uncomment them.
You also have to setup the Apacheenvironment variables. You will have to edit the /usr/sbin/envvarsfile. Add the following lines in the envvars file.
DYLD_LIBRARY_PATH=”$INFORMIXDIR/lib:$INFORMIXDIR/lib/cli: $INFORMIXDIR/lib/esql: $INFORMIXDIR/incl:$INFORMIXDIR/incl/cli: $INFORMIXDIR/incl/esql: /usr/lib:$DYLD_LIBRARY_PATH”
You may now start the Apacheweb server. Issue the following command with root user access permissions.
/usr/sbin/apachectl–f /etc/apache2/httpd.conf –k start
UnpackOAT source code at /Library/WebServer/Documents/OpenAdminTool.The ownership of all files under this directory has to be changed too. Makesure these files are owned by the user and group that runsapache. (These should match the user and group settings in/etc/apache2/httpd.conf)
Visithttp://<hostname>.<domainname>//OpenAdminTool/index.php andcontinue with the OAT web install. OAT should be operational after the OAT webinstall.