How to install Docmgr 0.58 in Debian 6.0 Squeeze

DocMgr is a PHP/Postgresql based document management system (DMS): I use it a lot, because it is simple to use and configure. It is not difficult to install in Debian Squeeze 6.0: here I will show you how to install an old version (0.58), because I had to migrate an instance of this version running in an old server (in the future I will upgrade that to the brand new version DocMgr 1.2.2).

apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get install apache2
apt-get install postgresql

To check that Apache2 is installed and to verify the current running version.

apachectl -v

During installation process of postgres a new user was created (named postgres): you must change the password related to this user.

passwd postgres

Use a strong password !

Now to check that Postgres is installed and verify the current running version type the command on the next.

su postgres
psql -c "select version();" template1

Now we have to install php5.

apt-get install php5
apt-get install php5-cli
apt-get install php5-pgsql
apt-get install php5-imap

To check that Php5 is installed and to verify the current running version create in /var/www/ a file named test.php, and insert this single line.

<!--?php phpinfo() ?-->

After that with the web browser get this URL: http://<server ip address>/test.php
If all works fine we can continue with the creation of the db in postgres

su postgres
createuser userdb
psql template1
alter user userdb password '<password for the postgres user named userdb>';
\q
exit
createdb -h localhost -W -U userdb docmgrbase

Now we have to restart apache to verify that all work fine, and we can install the docmgr files.

/etc/init.d/apache2 restart
cd /var/www

Download DocMgr v 0.58 (docmgr-0.58.tar.gz) and copy it in /var/www: we have to decompress this archive.

tar -zxvf docmgr*

Rename the created folder doc in docmgr

mv doc docmgr
mkdir /opt/docmgr
mkdir /opt/docmgr/import
cd /var/www/docmgr
mv files /opt/docmgr
chown -R www-data:www-data /opt/docmgr/files/
chown -R www-data:www-data /opt/docmgr/import/

In /etc/postgresql/8.4/main/pg_hba.conf add the line at the end of the file.

host docmgrbase userdb 127.0.0.1 255.255.255.255 md5

Restart postgres to check & load the modified version of pg_hba.conf.

/etc/init.d/postgresql restart

Now it is possible to create all the table in the database using the script docmgr.pgsql.

psql -h localhost -W -U userdb -d docmgrbase -f /var/www/docmgr/scripts/docmgr.pgsql

We have to modifiy the file /var/www/docmgr/config/config.php as in the following.

//connection settings
define("DBHOST","127.0.0.1");
define("DBUSER","userdb");
define("DBPASSWORD","<password for the postgres user named userdb>");
define("DBPORT","5432");
define("DBNAME","docmgrbase");

//use ldap for accounts. If set, alter ldap settings
//in ldap-config.php
//define("USE_LDAP","1");

//the directory you want the import module to look at (no trailing slash)
define("IMPORT_DIR","/opt/docmgr/import");

//absolute or relative path to the docmgr files directory (no trailing slash)
define("FILE_DIR","/opt/docmgr/files");

//administrator email (also return address for outgoing emails
define("ADMIN_EMAIL","admin@3tsistemi.it");

//site url for emailing links to files in event and task notifications
//also, this must be set appropriately for fckeditor to work. If a client
//uses a url different from this one, fckeditor will not load
define("SITE_URL","http://localhost/docmgr/");

Now we would have ended, but if you try to use the web browser with http://<Server Ip Address>/docmgr we get a blank page, and an error in /var/log/apache2/error.log like that in the next line.

PHP Fatal error:  Cannot redeclare date_diff() in /var/www/docmgr/lib/data_formatting.php on line 191

It is an error in the function date_diff that is no longer used: to solve you can edit the file /var/www/docmgr/lib/data_formatting.php and comment all the lines related the date_diff function.

//function date_diff($firstDate,$lastDate) {

//$fdArray = explode("-",$firstDate);
//$ldArray = explode("-",$lastDate);

//get how many days the difference is
//$diff = mktime(0,0,0,$fdArray[1],$fdArray[2],$fdArray[0]) - mktime(0,0,0,$ldArray[1],$ldArray[2],$ldArray[0]);
//$diff = abs($diff / 86400);

//return $diff;
//}

Now you can enter in docmgr with user admin and password admin
If all works fine you cant install these others external application (not mandatory) to use all the other function in docmgr.

apt-get install xpdf-reader
apt-get install xpdf-utils
apt-get install gocr
apt-get install zip
apt-get install gs
apt-get install enscript
apt-get install antiword
apt-get install libtiff-tools
apt-get install imagemagick
apt-get install ocrad

Linkografia
http://www.docmgr.org