November 21, 2006

How to set up and configure DocMGR

Author: Anže Vidmar

Document management systems do more than just store and retrieve files -- they also provide versioning, security, indexing, and metadata capabilities. DocMGR is a GPL-licensed Web-based document management system that supports LDAP directory service integration so that users on the network can authenticate against LDAP directly.

With a document management system you can easily store and manage all your electronic documents, from simple text files to multimedia files. DocMGR stores all its files in a PostgreSQL database, which makes it easy to backup, restore, and transfer the whole library to the new system, if necessary. All content in DocMGR is indexed, so you can retrieve documents easily with advanced search capabilities. Workflow features let you pass documents from one user to another for review, and document subscriptions can alert users when newer versions of documents are created.

I've successfully implemented DocMGR on five different Linux distributions. DocMGR depends on PHP, the Apache Web server, and the PostgreSQL database. If DocMGR is not in your favorite distro's package repository, you'll need to download, install, and configure it by hand.


The installation procedure described on DocMGR page is pretty straightforward, although you might run into some problems along the way. The project offers detailed instructions for setting up DocMGR on Debian, Fedora Core, and Red Hat Enterprise Linux distributions. Start with the general installation instructions.

First download the DocMGR tarball and extract it in your Web document root folder (e.g. /var/www/html).

Make sure you have the following packages installed: httpd, postgresql, postgresql-server, postgresql-libs, postrgresql-contrib, php, php-pgsql, ImageMagick, ImageMagick-c++, ImageMagick-perl, and xpdf. There are also several optional packages you can install to extend DocMGR's capabilities:

Email support
If you would like to be able to send documents directly form DocMGR, you need to install and configure a Mail Transport Agent on your system (e.g. sendmail or postfix).

Anonymous email support
If an MTA is installed, you can send documents to users outside DocMGR (external users). For example, when you send an anonymous email to external user, the target user will receive a URL that will point him to the document specified.

Antivirus support
If you install ClamAV virus scanner on your system, every uploaded, downloaded, and viewed file will be scanned for possible virus infection. If a virus is found, the current action will be canceled and the user and DocMGR administrator will be informed about the event.

If you install GOCR and LibTiff in addition to ImageMagick you'll be able to scan any paper document and save it as a text document file in DocMGR.

PDF indexing
If you install xpdf or Ghostscript, you will be able to index text inside PDF documents.

Download the whole collection of files at once
If you have the zip utility installed on your system, you'll be able to download every file from any collection at once in a single archive.

URL indexing
If you install wget, DocMGR will be able to index all the content on any URL link that you provide in DocMGR.

The next step in the installation process is to edit the /etc/php.ini file to enable uploads of files larger than 2MB, which is the default. Find the line in php.ini file that says "upload_max_filesize" and edit it to something like:

upload_max_filesize = 50M

Now you must correct a few permission and directory owner files. Change the permissions on the data and tmp folders so that everybody can read and write into them:
chmod 777 data tmp

Change the ownership of data and tmp directories to the Apache user:
chown apache:apache data tmp thumbnails

Next, make sure that PostgreSQL will be listening for external TCP connections on port 5432.
Edit the file /var/lib/pgsql/data/postgresql.conf and uncomment the following three lines:

port = 5432
tcpip_socket = false #and change the value to "true"
password_encryption = true

Create a new database and define a user that will have permission to write into this database. When this is done, import the tables from the docmgr.pgsql file that comes with your DocMGR package.

The last step is to configure the $DOCMGRHOME/config/config.php file to tell the DocMGR the database name, how to connect to it, and what database users have permission to write into this database. Edit the "Required Settings" section in the config.php file to your needs.

You can configure your DocMGR to be able to authenticate users against LDAP, but this feature is still in an early development stage and you're highly advised to test the configuration before using it on a production server.

Testing and troubleshooting

Point your Web browser to your DocMGR URL (e.g. and log in for the first time with user and password "admin". After you change the default admin password, you can create users and collections, manage users and group permissions, and perform other operations -- see the user manual for details.

Here are a couple of possible problems you might bump into:

When you try to connect to DocMGR URL, you get a blank page, and in the apache_error log you'll find an entry something like PHP Fatal error: Call to undefined function: scandir() in /var/www/html/doc/lib/xml.php on line 164. This error will occur if you have PHP libraries older than required. Upgrade to the newest version to fix the problem.

When you try to connect to DocMGR URL, you get Could not connect to database error. Possible reasons for this error are:

  • The username and/or password for the database user in php.config file is wrong.
  • The database name in config.php file is wrong.
  • The PostgreSQL service is not running on your system. Check whether the service is running with the command /etc/init.d/postgresql status.
  • The PostgreSQL service is not listening on the proper TCP port. Check whether the PostgreSQL service is listening on port 5432 with the command netstat -antpu | grep 5432. If the output of the command doesn't give any results, check the port and tcpip_socket settings in your /var/lib/pgsql/data/postgresql.conf file.


Among the many free document management systems for Linux, some of the better known are DoXFS, Docsys, and OpenDocMan. I prefer DocMGR, because I find it to be the most sophisticated of them. It provides a logical interface and all the features that a modern document management system needs.


  • Enterprise Applications
Click Here!