Installation & setup
Koha cannot locate the configuration file koha-conf.xml
The error means the process has no KOHA_CONF set, not that the file is gone. Run the command through koha-shell, and here is how to confirm the file really is where Koha expects it.
Updated 2026-08-12 · Tested against Koha 26.05
Nine times out of ten the file is exactly where it should be and the shell you ran the command in has no KOHA_CONF — Koha finds its configuration only through that variable. Run the command through sudo koha-shell <instance>, which sets it for you, and the error disappears without changing anything on disk.
What the error looks like
$ perl /usr/share/koha/bin/some-script.pl CAUTION: Can't find koha-conf.xmlunable to locate Koha configuration file koha-conf.xmlIt often arrives with a second, less helpful line — Can't call method "config" on an unblessed reference. That is the same fault one step later: the configuration object was never built, so the next line of Perl calls a method on nothing.
Step 1Get the instance name right
$ sudo koha-list libraryEvery instance is a directory under /etc/koha/sites/, and koha-list prints the ones that exist. Use that exact string below — koha, Koha and the library's name are the three things people guess, and none of them is it unless koha-list says so.
Step 2Run the command through koha-shell
$ sudo koha-shell library$ perl /usr/share/koha/bin/some-script.plReplace library with your instance name. koha-shell drops you into a shell owned by that instance's system user with KOHA_CONF and PERL5LIB already exported, which is the supported way to run anything by hand. To run a single command without staying in the shell, use -c:
$ sudo koha-shell -c "perl /usr/share/koha/bin/some-script.pl" libraryOr set the variable yourself
In a script that cannot call koha-shell — a systemd unit, someone else's wrapper — export the path directly. Nothing else reads it, so this is the whole fix:
$ export KOHA_CONF=/etc/koha/sites/library/koha-conf.xml$ export PERL5LIB=/usr/share/koha/libCheck whether the file really is missing
If the two steps above did not help, confirm the file exists before assuming anything else:
$ sudo ls -l /etc/koha/sites/library/koha-conf.xml -rw-r----- 1 library-koha library-koha 24596 Aug 9 11:02 /etc/koha/sites/library/koha-conf.xmlNote the ownership. The file is readable by the instance user and by root, and by nobody else — so the same command that works under sudo fails as an ordinary user with exactly this error, because Perl cannot open a file it is not allowed to read. That is the second most common cause after the unset variable.
If the file is genuinely not there, do not write a new one by hand
- Restore it from your backup —
koha-dumparchives the configuration alongside the database. - If there is no backup and no instance, the instance was never created: run
koha-createrather than repairing.
Why this happens
Koha has no compiled-in configuration path. Every process discovers its instance from the KOHA_CONF environment variable, and that is deliberate: it is what lets one server run twenty instances from one copy of the code, each with its own database, ports and paths.
Each place Koha runs sets the variable in its own way. Apache sets it per virtual host — the site file contains SetEnv KOHA_CONF "/etc/koha/sites/library/koha-conf.xml" in both the OPAC and the staff blocks, which is why the web interface works perfectly while a command in a terminal does not. The scheduled jobs get it from koha-foreach. A root shell gets it from nowhere at all.
So the error is almost never about a missing file. It is a command being run outside the only three contexts that were ever arranged to set the variable, and koha-shell exists precisely to be a fourth.
Troubleshooting
| What you see | What it usually is |
|---|---|
| The web interface works, a shell command does not | The classic case. Apache sets KOHA_CONF per virtual host; your shell does not. Use koha-shell. |
| Works under <code>sudo</code>, fails as your own user | File permissions, not configuration. koha-conf.xml is readable only by the instance user and root. |
| Fails for one instance and works for another | The instance name in the path is wrong. Check it against sudo koha-list. |
| <code>Can't call method "config" on an unblessed reference</code> | The same fault one line later — the config was never loaded. Fix the variable, not the Perl. |
| A cron job fails but the same command works by hand | cron has almost no environment. Wrap the job in koha-foreach or koha-shell -c. |
| The web installer cannot get past the database step | A different problem — the database credentials, not the config path. See finding your instance's admin password. |
If the staff interface itself is not answering rather than a script failing, the cause is on the Apache side instead — start with Koha, Apache and port 8080.
Would rather not do this yourself? We do it as a service — and if you would rather it were already done, it is on Koha Cloud before you log in.
Related
More on installation & setup
Answers to the questions that usually arrive with this one.
The Koha web installer returns a 500 error or times out
The installer dies partway through and the browser shows a 500 or a gateway timeout. Read the instance log to find out which step failed, then restart the install cleanly rather than retrying on a half-built database.
Can you install Koha on Windows? (WSL2, VMs, and when not to)
There is no Windows build of Koha. You can run it on a Windows machine through WSL2 or a virtual machine — which is fine for evaluation and wrong for a live library.
Koha, Apache and port 8080: staff and OPAC on two hostnames
Koha serves two websites from one install. Here is how the OPAC and the staff interface are separated, why staff lands on port 8080, and how to move it off.
Finding your Koha instance’s admin password (koha-passwd)
The credentials the Koha web installer asks for are generated at install time and printed by koha-passwd. Here is how to find them, and how to reset a staff login.

