Koha Solutions

Installation & setup

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.

Updated 2026-08-12 · Tested against Koha 26.05

The web installer runs one long request per step, so a 500 or a gateway timeout means a step died or ran past Apache's limit — not that Koha is broken. Watch /var/log/koha/<instance>/intranet-error.log while you retry the step, raise Apache's Timeout if it is the long one, and only then consider starting the database again.

Retrying a failed step on a half-built database is the trap

The installer creates tables as it goes. Clicking back and re-running after a failure part-way through leaves a mixture of built and unbuilt tables, and every later error is then a consequence of that rather than of the original fault.
  • Find the real error first — it is in the log, not on the screen.
  • If the schema step is the one that failed, drop and recreate the database rather than re-running over it.
  • None of this applies once the installer has finished. On a live catalog, do not drop anything.

Step 1Find which step actually failed

Terminal
sudo tail -f /var/log/koha/library/intranet-error.log

Leave that running, then retry the installer step in the browser. The first new line is the fault. The generic 500 page carries no detail on purpose — reading the right log file covers what the common messages mean.

Step 2If it is a gateway timeout, give it longer

One or two steps — building the schema, loading the sample data — take minutes on a modest server. Apache gives up first and returns 504 while the step is still running underneath, which is why the timeout often "fixes itself" if you wait and reload.

/etc/apache2/apache2.conf
Timeout 600
Terminal
sudo apache2ctl configtestsudo systemctl reload apache2

Ten minutes is generous and temporary — put it back to the default (300) once the install is finished, because a long timeout on a live site keeps dead connections occupying workers.

Step 3If it cannot get past the database step

The installer asks for a database user and password. They are generated when the instance is created — not chosen by you, and not the MySQL root password:

Terminal
sudo koha-passwd library koha_libraryS3cr3tGenerated

Confirm those credentials actually work before blaming the installer:

Terminal
sudo koha-mysql library -e "SELECT DATABASE(), CURRENT_USER();" DATABASE()	CURRENT_USER()koha_library	koha_library@localhost

If that fails, the problem is the database, not Koha. The full explanation of where these credentials come from is in finding your Koha instance's admin password.

Restarting the install cleanly

When the schema step failed part-way, the supported reset is to remove the instance and create it again — it is a fresh install, so there is nothing to lose, and it is far more reliable than repairing a partial schema by hand.

Terminal
sudo koha-remove librarysudo koha-create --create-db library

koha-remove deletes the instance and its database

It is the right command during a first install and a catastrophe on a running one. Check sudo koha-list twice and make sure the name you are about to type is the empty instance.

Then reload the staff URL and the installer starts again from the first step.

Why the installer is fragile in this one way

The web installer is an ordinary CGI script doing a very unordinary amount of work: it creates every table, loads the mandatory data, and on request loads sample records — all inside a single HTTP request, with a browser waiting. Anything with a request deadline in front of it (Apache's Timeout, a reverse proxy, a load balancer) will eventually decide the request is dead.

That also explains the shape of most reports: the failure appears on the same one or two steps for everybody, it is worse on small virtual machines, and it goes away on a server with faster disk. It is not a sign that the install is going wrong in some deeper way.

The other frequent cause has nothing to do with time. If the environment is wrong — no configuration path, a database the user cannot reach — the very first step 500s immediately rather than hanging. An instant failure and a slow one are different problems, and the log tells them apart in one line. Start there, and see Koha cannot locate koha-conf.xml if the message names the configuration file.

Share this article

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.