Guide
DocWeb runs on a Synology NAS or on an ordinary web server. Choose the route that suits your environment – the steps for the OCR tools and the setup after installation apply to both.
DocWeb is deliberately undemanding: no framework dependency, no Node.js, no build steps. Essentially you need a web server with PHP and a database.
pdo_mysql, mbstring, zip, zlib, jsonutf8mb4.env, documents/, inbox/, trash/)pdftotext, pdftoppm)shell_exec must be allowed on the server so that the tools can be calledzip extension. Only scanned PDFs and images then remain without full text – the file name, category and tags are still searchable. Route A
The recommended route if DocWeb is to run on your own network on a Synology. Access is then typically possible only on the local network or through a VPN.
In the Synology Package Center install the packages Web Station, PHP 8.x and MariaDB 10. Then, under Web Station → Web service, create a web server with PHP 8 if none exists yet.
Copy the complete project folder to /volume1/web/docweb – that is, the folder containing public/, src/ and sql/. The folders documents/, inbox/ and trash/ are created automatically during installation.
Using phpMyAdmin (or via SSH) create a database together with a user:
CREATE DATABASE docweb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'docweb'@'localhost' IDENTIFIED BY 'DEIN_PASSWORT';
GRANT ALL PRIVILEGES ON docweb.* TO 'docweb'@'localhost';
FLUSH PRIVILEGES;
.env
In the project folder (one level above public/) create a file .env:
DB_HOST=localhost
DB_PORT=3307
DB_NAME=docweb
DB_USER=docweb
DB_PASSWORD=DEIN_PASSWORT
3307 by default, not on 3306. Adjust accordingly for an external database.
Open http://NAS-ADRESSE/docweb/install.php in the browser and fill in the form. The assistant creates all tables, writes the credentials into .env, creates the folders and sets up the first admin account.
Alternatively, via SSH in the project folder: php install.php. Without --admin-pass a random password is generated and shown once.
install.php.
The assistant refuses to work as soon as a user account exists – even so, it does not belong on the server permanently. Under Web Station → Script languages → PHP 8.x → Configuration:
shell_exec must not be listed in disable_functions (otherwise no OCR)pdo_mysql, mbstring, zip, zlib, jsonFor scanned documents set up Tesseract and Poppler – the instructions are in the Setting up the OCR tools. Without this step DocWeb works, just without full text in scans.
Sign in at http://NAS-ADRESSE/docweb/ and click Sync in the top bar. Then run Reindex once if the OCR tools were set up – that also captures scans that are already there.
Route B
For a rented server, your own machine or a virtual machine. This makes DocWeb reachable from anywhere – so pay particular attention to the security notes at the end of this section.
On Debian or Ubuntu a few packages are enough:
sudo apt install apache2 mariadb-server php php-mysql php-mbstring \
php-zip php-gd php-curl libapache2-mod-php
sudo mysql_secure_installation
For nginx instead of Apache, install the same PHP packages with php-fpm.
Copy the complete project folder to the server. Place it outside the publicly reachable directory and point the domain at the public/ subfolder:
/var/www/docweb/ <- project folder (not public)├── public/ <- this is where the domain points├── src/
├── sql/
├── documents/
├── inbox/
└── trash/
For Apache, for example:
<VirtualHost *:443>
ServerName docweb.example.ch
DocumentRoot /var/www/docweb/public
<Directory /var/www/docweb/public>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Alternatively the project folder itself can be the web directory – the application then sits under /public/ and is reachable for example at https://example.ch/public/. That setup is supported too; the first variant is cleaner, however.
sudo mysql -e "CREATE DATABASE docweb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
sudo mysql -e "CREATE USER 'docweb'@'localhost' IDENTIFIED BY 'DEIN_PASSWORT';"
sudo mysql -e "GRANT ALL PRIVILEGES ON docweb.* TO 'docweb'@'localhost'; FLUSH PRIVILEGES;"
.env
In the project folder (one level above public/):
DB_HOST=127.0.0.1
DB_PORT=3306
DB_NAME=docweb
DB_USER=docweb
DB_PASSWORD=DEIN_PASSWORT
The web server user (on Debian/Ubuntu www-data) must be able to write in the project folder – for .env and the folders documents/, inbox/ and trash/:
sudo chown -R www-data:www-data /var/www/docweb
sudo find /var/www/docweb -type d -exec chmod 750 {} \;
sudo find /var/www/docweb -type f -exec chmod 640 {} \;
Open https://docweb.example.ch/install.php in the browser and fill in the form. Then delete install.php.
After signing in, click Sync in the top bar. How the sync runs depends on whether a command-line PHP can be started on the server:
.env: PHP_CLI=/usr/bin/phpshell_exec or popen is blocked): DocWeb switches automatically to the web variant and works through the sync in short steps via the web server. The status bar then shows a note to keep the window open – the process continues as long as the page stays open. If it is closed, the next visit carries on from the last state..env, for example WEB_WORKER_BUDGET=10 (seconds per step). public/ (see step 2) so that src/, documents/ and .env are not reachable over the webDOCS_ROOT in .env for that, for example DOCS_ROOT=/srv/documentsFull text in scans
These tools are optional. Without them the search finds no text in scanned pages and images. With them the content is recognised and becomes searchable.
Tesseract and Poppler come from the package manager, along with the language data:
sudo apt install tesseract-ocr tesseract-ocr-deu tesseract-ocr-eng \
tesseract-ocr-fra tesseract-ocr-ita poppler-utils
Then check whether the tools are found:
which pdftotext pdftoppm tesseract
tesseract --list-langs
The former packages for Tesseract and Poppler are no longer available for newer DSM versions. Two routes work: Entware (binaries directly on the file system, recommended) or a Docker-Container that provides the binaries through a directory.
First sign in by SSH as admin and become root with sudo -i. Enable SSH beforehand under Control Panel → Terminal & SNMP.
# Create a persistent directory (survives DSM updates)
mkdir -p /volume1/@Entware/opt
mount -o bind /volume1/@Entware/opt /opt
# Install Entware – choose the URL matching your CPU architecture
# x86_64 (e.g. RS1221RP):
wget -O - https://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
# ARMv8 (e.g. DS920+):
# wget -O - https://bin.entware.net/aarch64-k3.10/installer/generic.sh | /bin/sh
Then install the packages:
/opt/bin/opkg update
/opt/bin/opkg install tesseract tesseract-data-eng poppler-utils
poppler-utils, not poppler. Entware has no German language package – deu has to be installed by hand. cd /opt/share/tessdata
wget -O deu.traineddata https://raw.githubusercontent.com/tesseract-ocr/tessdata/main/deu.traineddata
/opt/bin/tesseract --list-langs # "deu" has to appear
The binaries then live under /opt/bin/. If they are not found automatically, enter them in .env:
PDFTOTEXT_PATH=/opt/bin/pdftotext
PDFTOPPM_PATH=/opt/bin/pdftoppm
TESSERACT_PATH=/opt/bin/tesseract
So that the tools survive a restart of the NAS, add the supplied script in the Task Scheduler (Control Panel → Task Scheduler → Triggered Task, trigger "On boot", user root):
/bin/sh /volume1/web/docweb/scripts/entware_boot.sh
The script mounts /opt again, reinstalls Entware and the packages if needed and takes care of the OCR language data.
A container provides the binaries through a shared directory:
docker run -d --name ocr-tools \
-v /volume1/web/docweb/tools:/tools \
debian:bookworm-slim \
bash -c "apt-get update && apt-get install -y tesseract-ocr tesseract-ocr-deu \
tesseract-ocr-eng poppler-utils && \
cp /usr/bin/tesseract /usr/bin/pdftotext /usr/bin/pdftoppm /tools/ && sleep infinity"
Since the files are not on the search path, set the paths in .env:
PDFTOTEXT_PATH=/volume1/web/docweb/tools/pdftotext
PDFTOPPM_PATH=/volume1/web/docweb/tools/pdftoppm
TESSERACT_PATH=/volume1/web/docweb/tools/tesseract
After signing in, the user menu at the top right shows whether the three tools were found: pdftotext (PDF text), pdftoppm (render pages) and tesseract (OCR).
https://docweb.gregus.ch/.
DocWeb creates a backup of database and documents as a ZIP. Since the documents exist as ordinary files anyway, backing up the document folder with the usual tools is enough for the collection – a complete migration also needs the database and .env.
Usually a PHP extension is missing or the database is unreachable. Check the PHP error output of the server (Apache: error.log, nginx: /var/log/nginx/error.log). Common causes: pdo_mysql missing, wrong port, wrong password in .env.
src/config.php is missing
Then install.php is not in the project folder, or the level above it contains no src/. Upload the complete project folder – not just the contents of public/. The installer recognises both layouts (project folder and public/) by itself.
The web server user is not allowed to write in the project folder. Set the permissions as in step 5 (route B). On a Synology, check whether the shared folder is writable for the Web Station user.
The OCR tools are missing or cannot be called. The user menu shows the status of the three tools. If all three are missing, shell_exec is usually blocked in disable_functions – or the paths have to be set in .env. After correcting that, run Reindex once.
This needs the PHP extension zip. Enable it and start the reindex again.
On servers without a startable command-line PHP the web variant takes over automatically (see step 7 in route B). If the message still appears, check:
WEB_WORKER_BUDGET in .env (e.g. 10)..env? PHP_CLI=/usr/bin/phpIn web mode the browser performs the work steps. If the page is closed the process pauses – nothing is lost. The next visit continues from the last state.
The installer does not create a second account once one exists – that is intentional. Reset the password directly in the database or create a new user with the admin role through phpMyAdmin.