How to reload the Kimai cache system
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 other information which are time-consuming to calculate and which should not be evaluated on every request.
How to reload Kimai cache
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.
Adjust file permission
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):
Something went wrong / 500 error
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!
- Adjust the line
chgrp -R www-data .and replace
www-datawith the username for your webserver
- Create the file
cache.shin the Kimai base directory
- Allow to execute the file with
chmod +x cache.sh
- Run the script
#!/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/