When running in the
prod environment (which is always true unless you want to develop with Kimai) and you executed one
of the following tasks within Kimai you need to reload its cache:
Kimai not only caches configuration files, but also the list of installed bundles and many other informations which are time consuming to calculate and which should not be evaluated on every request.
It is not advised, but in case the above command fails you could try:
It might be necessary to execute these commands as webserver user, read the Installation docs for more details.
Depending on your setup and the way you call the cache command, you have to fix directory permissions afterwards.
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):
Test Kimai before executing these commands (they are likely not required in a shared-hosting environment).
You probably need to prefix them with
the group might be called different than
This is very often caused by rebuilding the cache without fixing the file permissions.
Please check your logs at
var/log/prod.log - if you can’t find that file it is even more likely that you have a permission problem!
This little script can simplify the cache rebuilding task. Be careful if you don’t understand what it does!
chgrp -R www-data .and replace
www-datawith the username for your webserver
cache.shin the Kimai base directory
chmod +x cache.sh
#!/bin/bash if [[ ! -d "var/" || ! -d "var/cache/prod/" ]]; then echo "Cache directory does not exist at: var/cache/prod/" exit 1 fi if [[ ! -f "bin/console" ]]; then echo "Kimai console does not exist at: bin/console" exit 1 fi rm -r var/cache/prod/* bin/console kimai:reload --env=prod chgrp -R www-data . chmod -R g+r . chmod -R 775 var/ chmod -R g+rw public/avatars/