Table of Contents

Debian GNU Linux iHTML HOWTO

Installing iHTML

First install UnixODBC as shown in the UnixODBC HOWTO.

Next install some libraries iHTML uses:

aptitude install libgd2 libpng3 libfreetype6 libjpeg62

Now we can download the iHTML installer from http://www.ihtml.com/download/installer.ihtml.

cd ~
mkdir ihtml
cd ihtml
wget http://ftp.inline.net/public/client/installer/installerlinux.tar.gz

Unzip the files:

tar zxvf installerlinux.tar.gz

Now move to the installer directory and run setup:

cd installer
./setup

Proceed through the installer, downloading the iHTML package, unzipping and installing.

Check the lines added to /etc/apache2/httpd.conf look something like this:

# iHTML Module
LoadModule ihtml_module /usr/ihtml/ihtml.so

# iHTML module
AddType text/ihtml .ihtml .ihtm .ienc .inc .m2p .m2e .m2m
AddHandler ihtml-handler .ihtml .ihtm .ienc .inc .m2p .m2e .m2m

Alias /ihtml /usr/ihtml/ihtml
<Directory "/usr/ihtml/ihtml">
    AllowOverride None
    Options All
    order allow,deny
    allow from all
</Directory>

Alias /ihtml_config /usr/ihtml/ihtml_config
<Directory "/usr/ihtml/ihtml_config">
    AllowOverride None
    Options All
    order allow,deny
    allow from all
</Directory>

Alias /merchant /usr/ihtml/merchant
<Directory "/usr/ihtml/merchant">
    AllowOverride None
    Options All
    order allow,deny
    allow from all
</Directory>

If you prefer to enable on a per-vhost basis then you can move those lines to your vhost config, except for the LoadModule statement which should remain in httpd.conf.

Upgrading to the latest Beta

http://www.ihtml.com/download/downbeta.htm

At time of writing the 2.20.500 stable release of iHTML is very old. To use iHTML with Apache2 you'll need to upgrade to the latest beta.

Don't be put off by the term beta; this release would be better described as release candidate and is by far the most stable version. For details see: http://www.ihtml.com/download/downbeta.ihtml.

Here I download the 2.20.1601 release for Apache 2.2 prefork:

cd ~/ihtml
wget http://ftp.inline.net/public/client/221beta/linux.apache223.tar.gz
tar zxvf linux.apache223.tar.gz

Now swap out the ihtml.so file shipped with the installer for the beta ihtml.so:

mv /usr/ihtml/ihtml.so /usr/ihtml/ihtml.so.2.20.500
mv ihtml.so /usr/ihtml
chown root:root /usr/ihtml/ihtml.so
chmod 600 /usr/ihtml/ihtml.so

Finally restart Apache:

/etc/init.d/apache2 restart

Testing iHTML

You can access the iHTML test page at an address like: http://localhost/ihtml

To test MySQL connections through UnixODBC, create a test database and user and then set-up an ODBC data-source in /etc/odbc.ini:

[test]
Description = MySQL Test
Driver      = MySQL
SERVER      = localhost
USER        = test
PASSWORD    = test
PORT        = 3306
DATABASE    = test
Option      = 3

Then add the following to /usr/ihtml/ihtml/congrats.ihtml:

<p>Let's try MySQL:</p>
<table>
<iHTML DBNAME="test" LOGIN="test/test" SQL="SELECT * FROM test" OUTPUT="<tr><td>:1</td></tr>" FAILURE="ERROR: <br>:i_sqlerrortext <p>:i_sqlerrorstmt<br>">
</table>

Configuring iHTML

You can access iHTML config settings here:

http://localhost/ihtml_config

You may need to add your IP address to /usr/ihtml/ihtml_config/hosts.allow as shown below:

'127.0.0.1', '1.2.3.4'

I needed to fix the permissions on a related log file before I could access the config system:

chmod 666 /usr/ihtml/ihtml_config/access.log

Logging Tweaks

I like to move iHTML's log files to more appropriate locations:

mkdir /var/log/ihtml
mv /usr/ihtml/ihtml.log /var/log/ihtml/
mv /usr/ihtml/log/tagerror.log /var/log/ihtml
mv /usr/ihtml/ihtml_config/access.log /var/log/ihtml

Set permissions (it seem these do need to be writable by the web-server user):

chown -R root:adm /var/log/ihtml
chmod 755 /var/log/ihtml
chmod 666 /var/log/ihtml/ihtml.log
chmod 666 /var/log/ihtml/tagerror.log
chmod 666 /var/log/ihtml/access.log

Create sym-links from the old locations to the new locations for good measure:

ln -s /var/log/ihtml/ihtml.log /usr/ihtml/ihtml.log
ln -s /var/log/ihtml/tagerror.log /usr/ihtml/log/tagerror.log
ln -s /var/log/ihtml/access.log /usr/ihtml/ihtml_config/access.log

Finally, update the 'registry' settings to use the new paths and restart Apache:

ee /usr/ihtml/registry/hkey_local_machine/software/inline/ihtml/currentversion.nv
diaglogpath     <reg_sz>        /var/log/ihtml/diag.log
ErrorLogPath    <reg_sz>        /var/log/ihtml/tagerror.log
ThreadLogPath   <reg_sz>        /var/log/ihtml/thread.log
/etc/init.d/apache2 restart

You should also configure logrotare.d to rotate those log files:

ee /etc/logrotate.d
/var/log/ihtml/*.log {
        daily
        missingok
        rotate 30
        compress
        delaycompress
        notifempty
        create 666 root adm
        sharedscripts
        postrotate
                if [ -f /var/run/apache2.pid ]; then
                        /etc/init.d/apache2 restart > /dev/null
                fi
        endscript
}

iHTML and apache2-mpm-itk

mpm-itk is an multi-processing module for Apache 2 which allows you to run each of your vhosts under a separate uid and gid. mpm-itk is based on the traditional prefork MPM.

I've tested iHTML under mpm-itk and it seems too work just fine. We're now running it in production without any difficulties.