Installing and configuring Komplete CMS on Linux/Apache

Komplete is a CMS system developed in PHP. To install on Apache using the PHP module there are a number of other requirements that must be met. After dropping the komplete dir into your /var/www/html/ dir and configuring access in httpd.conf to that directory, the installation page for Komplete guides you through what prequisites are needed. Out of the box on my Fedora Core 4 server with Apache 2.0.54 here’s the feedback from the installation page:

<code>
OS Version:     Linux   Passed
PHP Version:    5.0.4   Passed
DOMXML/DOMXSLT: Yes/No  Not found
Multibyte String:       Yes/No  Not found
GD:     Yes/No  Not found
PHP-MySQL:      Yes/No  Exist
ImageMagick:    Yes/No  Exist
File Writable:  Writable        Not Passed
PHP Session:    Yes/No  Exist
</code>

The help on the install page guides you through was needs to be installed and configured:


DOMXML/DOMXSLT: Komplete requires the DOMXML/DOMXSL extensions active in your PHP installation. These extensions are actually wrappers for the libxml2 and libxslt1 GNOME libraries, that provide a very powerful and fast layer for XML/XSL transformations. To activate your DOMXML/XSL libraries, you should have those libraries installed (if you have a recent version of Linux on your server, libxml2 and libxslt1 should be already installed, as they are shipping with the GNOME package. We have tested with the Redhat 8 server system, the exact versions being : libxml-2.4.14, libxslt-1.0.19). If you don't have libxml and libxslt installed on your system, download them from http://xmlsoft.org and http://xmlsoft.org/XSLT/ and compile them. Then you should recompile your PHP version by adding the "--with-dom --with-dom-xslt --with-dom-exslt" configuration options before compiling.
You might also want to download our precompiled PHP distribution (packaged as RPM for RedHat 8.0) from ftp://ftp.interakt.ro/pub/Krysalis/rpms/

I checked that these libraries were installed:

<code>
#rpm -q libxml2
libxml2-2.6.19-1

# rpm -q libxslt
libxslt-1.1.14-2
</code>

(There is further info about installing and using DOMXML here: http://www.devarticles.com/c/a/PHP/Parsing-XML-With-DOMXML-And-PHP/1/

I then downloaded latest php src 5.0.5 from php.net, and ran the configure script with the options to compile in the needed features:

<code>
./configure --with-dom --with-dom-xslt --with-dom-exslt --enable-mbstring --with-gd
</code>

This gave an error:

<code>
If configure fails try --with-jpeg-dir=<DIR>
configure: error: libpng.(a|so) not found.
</code>

To fix this I downloaded libpng from: http://www.libpng.org/pub/png/libpng.html, copied the makefile from the scripts dir as per the instructions, and then:

<code>
make
make install
</code>

On running the configure script for php again, I got the next error:

<code>
If configure fails try --with-jpeg-dir=<DIR>
configure: error: PNG support requires ZLIB. Use --with-zlib-dir=<DIR>
</code>

… so now the configure script looked like this:

<code>
./configure --with-dom --with-dom-xslt --with-dom-exslt --enable-mbstring --with-gd
 --with-jpeg --with-zlib
</code>

.. this was clean, so then followed by:

<code>
make install
</code>

At this point I had unknowingly built the cgi mode PHP, and I needed the module for Apache.

Adding

<code>
--with-apxs2
</code>

compiles the Apache2.0 module.

<code>
./configure --with-dom --with-dom-xslt --with-dom-exslt --enable-mbstring --with-gd --with-zlib --with-mysql --disable-cgi --with-apxs2

make
make install
</code>

The .so was still not created. In order to compile Apache modules you need httpd-devel installed (for the apxs2 api):

<code>
yum install httpd-devel
</code>

Ran configure, make and deploy, and this time I had the module.

Copied .so to apache modules
– changed httpd.conf to point to php module.

At this point I had gained everything minus domxml and domxsl. I decided at this point togo back to PHP 4.4 which I think has different support for domxml and domxs. I configured and installed it the same as the steps above for PHP 5.0.

This post on the KompleteCMS website gives exact instructions on compiling and installing the exact versions of domxml and domxsl needed: http://www.kompletecms.com/support/forum/komplete_lite_forum/?top=6770

Lessons learnt after a server crash

My linux server went down last weekend and would no longer boot. It had some sort of hardware issue with the disk controller card, and when it rebooted it would no longer see the card. Strangely, after leaving it off for half hour and trying again it came back to life. However, when I powered it back up it the /etc/fstab file was missing and gave me plenty of problems during start up, about not being able to execute init, couldn’t find the kernel, couldn’t find initrd etc.

So it should have been easy enough to recreate the fstab file and get going again, but it seems something had changed in the hardware and the main harddrive was now hde instead of hda. No idea why. It is hanging off a separate controller card and not the onboard IDE, so would hda and hdb be on the first channel on the onboard, hdc and hdd on the second, them hde be on the first channel on the controller card? I’m not sure.

Anyway, long story short, e2fsck spent about an hour fixing errors on the drive. At some point the ext3 file system got converted to ext2, and who knows what else.

Good job I had weekly backups of my MySQL databases, website files, and deployed webapps on JBoss. Wouldn’t take too long to reinstall the server and start again right? Wrong. Over time I had configured and tweaked so many things to get everything working just right, that I think to get back to this up and running state has taken about 15 hours. Normally I take good notes on what I configure, but there were a few things I had no idea how I originally got working (for example, how I configured Kompete CMS using to use DOMXML and DOMXSL on PHP5.0)

Ok, lessons learnt:

  • data files backups are great, but are at very least a minimum
  • backup the whole system, not just data files

I used Ghost to image the whole machine prior to reinstalling, so I have an image of the whole machine in its somewhat corrupted state prior to reinstall, and once everything is configured just as I want it I’ll reimage again for my main backup.

I guess this was a hard lesson to learn.

Also, I narrowly escaped a second disaster when I was working on configuring services on the machine as the power went out and the machine went down! Luckily it came back up fine with minimal errors on a e2fsck.

Next steps:

  • Reimage the whole machine in it’s ‘up and running’ state’.
  • Buy a UPS
  • Buy an identical second hard drive and set up RAID 1 mirroring

I guess on the whole this machine has done pretty well – up until this point it was up for 152 days without a reboot, and had been working fine with no problems whatsoever (try that on a Windows server).