The recommended way to install Kimai v2 is via SSH, you need GIT and Composer.
To install Kimai 2 in your production environment, connect with SSH to your server and change to your webservers (document) root directory. You need to install Git and Composer if you haven’t already.
First clone this repo (1.12 is the latest stable release):
git clone -b 1.12 --depth 1 https://github.com/kevinpapst/kimai2.git
cd kimai2/
Now install all dependencies:
composer install --no-dev --optimize-autoloader
Configure the database connection in the .env
file:
DATABASE_URL=mysql://user:password@127.0.0.1:3306/database
And run the Kimai installer:
bin/console kimai:install -n
The webserver needs write permissions for several directories, so make sure the file permissions are correct.
You have to allow PHP (your webserver process) to write to
var/
and it subdirectories.
Here is an example for Debian/Ubuntu (to be executed inside the Kimai directory):
chown -R :www-data .
chmod -R g+r .
chmod -R g+rw var/
chmod -R g+rw public/avatars/
Test Kimai before executing these commands (they are likely not required in a shared-hosting environment).
You probably need to prefix them with sudo
and
the group might be called different than www-data
.
There are several options to create your first user:
bin/console kimai:create-user username admin@example.com ROLE_SUPER_ADMIN
ROLE_SUPER_ADMIN
If you are going to import data from Kimai v1 choose a username & email that was not used in v1.
Configure your web server (like Nginx or Apache) to point its DocumentRoot at the public/
directory.
For more details, see the Webserver How-To.
Oh … wait! Before you leave, please read the initial setup guide.
There is a dedicated article about Docker setups for Kimai, suitable for development and production.
The following platforms adopted Kimai 2 to be compatible with their one-click installation systems.
Cloudron provides a secure and ready to use Kimai package, which will be kept up-to-date automatically.
Be aware that VestaCP uses the admin
user instead of www-data
. Replace the names in the permission commands above.
Read this issue if you have further questions.
CloudJiffy provides a scalable, hourly billed and easy to use PaaS platform and the setup of Kimai is only a click of a button away. Kimai is always deployed from the latest Github branch, thus you can rest easy that your software will always be up-to-date.
How to install Kimai at shared hosting companies. Please share our insights if you have managed to get it up and running with another company!
If you can’t find the correct version, ask your hoster! Or let us help you.
php -v
/usr/bin/php7.3-cli
(even composer)/usr/bin/php7.3-cli composer.phar install --no-dev --optimize-autoloader
/usr/bin/php7.3-cli bin/console kimai:install -n
curl -sS https://getcomposer.org/installer | php7.3.5-cli
php -v
php7.3.5-cli
(even composer)php7.3.5-cli composer.phar install --no-dev --optimize-autoloader
php7.3.5-cli bin/console kimai:install -n
Strato has a special setup of PHP, you need to find the proper version first.
/opt/RZphp{major}{minor}/bin/php-cli
(Shared Hosting)/usr/bin/php{major}{minor}
(Managed Server)For example, if you want to use PHP 7.3 use always the absolute path when running a PHP based command: so prefix all commands with eg. /opt/RZphp73/bin/php-cli
in bash.
How to install Kimai:
curl -sS https://getcomposer.org/installer | /opt/RZphp73/bin/php-cli
cd kimai2
/opt/RZphp73/bin/php-cli ../composer.phar install --no-dev --optimize-autoloader
.env
file, eg. with nano .env
/opt/RZphp73/bin/php-cli bin/console kimai:install -n
Reload your configuration /opt/RZphp73/bin/php-cli bin/console kimai:reload
cd kimai2
curl -sS https://getcomposer.org/installer | /usr/bin/php
php composer.phar install --no-dev --optimize-autoloader
nano .env
php bin/console kimai:install -n
php bin/console kimai:reload
See issue #1620.
This is NOT recommended, but still widely used …
Please, do yourself a favour and get a hoster that includes SSH access, it is not 2002 anymore! Nowadays even cheap contracts should support SSH.
Now read on: Kimai FTP installation + tips and tricks.
Webarchitects Co-operative have written a Kimai 2 Ansible Galaxy role for automatically installing and upgrading Kimai sites on their shared hosting servers.
SQLite is a great database engine for testing, but when it comes to production usage it is not supported for Kimai:
Kimai tries to work around the Foreign Keys issue by using a Doctrine PostConnect EventSubscriber, but this does not work in all environments (SQLite needs to be compiled with foreign support), it is not intended to be used in production environments and it can’t be guaranteed that SQLite handles everything as expected!
If you insist on using SQLite: make a copy of the database file BEFORE each update to prevent possible data loss and don’t ever delete data that is already linked to other data (like customers/projects/activities used in timesheets) …
And don’t file any bug report - you have been warned!
That usually means that your DATABASE_URL
is wrong. You can run a command like bin/console doctrine:schema:validate
to check,
if the software can connect successfully to your database.
If that gives you the same error, it is configuration issue which you need to solve first, before you are able to install Kimai.
If you see an error message like this, then you have a special character in your DATABASE_URL
.
!!
!! In DriverManager.php line 259:
!!
!! Malformed parameter "url".
!!
This can be a character like @
or /
or some others, which need to be urlencoded.
This can easily be done with one command, lets assume your password is mG0/d1@3aT.Z)s
then you get your password like this:
php -r "echo urlencode('mG0/d1@3aT.Z)s');"
mG0%2Fd1%403aT.Z%29s
Then your DATABASE_URL
might look like this:
DATABASE_URL=mysql://root:mG0%2Fd1%403aT.Z%29s@127.0.0.1:3306/kimai2
The installation instructions are intended primarily for server applications.
If you are installing Kimai 2 on your personal computer - maybe for use in a local network, but where the computer primarily
serves as a single user computer - you will avoid permission errors by substituting www-data
in the relevant commands with your username.
In particular, sudo -u www-data
is a command which grants the www-data
user temporary administrator/super-user privileges).
However, depending on the configuration of your particular computer, you may be able to avoid sudo
altogether (your user
may already have adequate permissions). Or your webserver user is not called www-data
but httpd
.
You can try first leaving sudo -u www-data
altogether in the relevant commands.
If you have permission errors, you can substitute it for sudo -u $USER
in the relevant commands, where username is the
username that runs the server - if you don’t know, it is likely your own username that you login with.
Further, chown
and chmod
commands should be for the username that runs the server instead of www-data
(again, if you
don’t know, it is likely your own username).
Also note that, depending on where you are installing Kimai 2 and how your computer is configured, you may also receive
“operation not permitted” errors when setting file permissions (chown
and chmod
commands).
In that case, prefix them with sudo
.
These infos were added to give you some possible guidance if you run into troubles. The Linux (and Mac) filesystem with its permission structure, especially when using server software, can be tricky and challenging.
But this has NOTHING to do with Kimai and we might not be able to help you in such situations … it is your system and responsibility, be aware that wrong permissions might break Kimai and can also lead to security problems.