Monday, 19 November 2012

Installing queXF in Ubuntu

queFX is a web based Intelligent Character Recognition(ICR) software. queFX can be used as a Computer Assisted Data Entry(CADE) tool. It is written in PHP and uses MySQL as backend. In this document I am going to install queXF in an Ubuntu 12.04 box. We will need Apache, PHP, MySQL, ADOdb and Ghostscript.

Install Apache

# apt-get install apache2

Install MySQL

# apt-get install mysql-server

Install PHP5 and required extensions

# apt-get install php5 php5-gd php5-mysql

Install Ghostscript

# apt-get install ghostscript

Download and extract ADOdb from

# unzip

Copy the extracted directory into some location

# cp -r adodb5 /usr/local/


Change post_max_size to 10MB, upload_max_filesize to 10MB and memory_limit to 128MB in PHP configuration file

# pico /etc/php5/apache2/php.ini





Download queXF from

Extract the zip file

# unzip

Copy the extracted files into Apache’s document root directory

# cd quexf-1.13.5/

# cp -rf * /var/www/

Change the owner of the files from current user

# chown -R www-data:www-data *


We need to enable user authentication in Apache.

Create a password file for Apache and store this file is in some safe location (somewhere not accessible from the web).

# mkdir -p  /usr/local/apache/passwd

# htpasswd -c /usr/local/apache/passwd/passwords pranabs


Add more user using the same command but without –c option, otherwise it will overwrite the file and previously created users:

# htpasswd /usr/local/apache/passwd/passwords ajitj


My apache config file for default site looks like

# cat /etc/apache2/sites-available/default

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                Allow from all

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128



Create .htaccess file in the queFX root directory

#pico /var/www/.htaccess

and add the following content:

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /usr/local/apache/passwd/passwords
Require valid-user


Restart Apache

# service apache2 restart


Create MySQL database and user

mysql> create database quexf;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on quexf.* to 'quexf'@'localhost' identified by 'quexf';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Import the quexf database script provided inside the database folder inside quexf application directory.

# mysql -u quexf -pquexf quexf < /var/www/database/quexf.sql


Change the queXF configuration file, set the database connection details and path for ADOdb and Ghostscript

# pico /var/www/



To test the configuration, open the link (http://servername/admin/?page=testconfig.php)


You will be asked for username and password.



Enter user login that we created with htpasswd command. If configuration is fine, we will see the Passed Configuration Test message:




That’s it, our queXF installation is ready Smile .