How to make the diagnostic “Managing processes via CLI” to display Ok?
In Matomo Diagnostics, there is a check for “Setup Cron – Managing processes via CLI”. It is helpful to get this to work OK especially whenever you manage a high traffic Matomo instance or if there are a lot of websites or segments to be archived (learn more about improving Matomo performance).
For this diagnostic “Setup Cron – Managing processes via CLI” to work OK you need:
- The following PHP functions must be enabled:
shell_exec
,getmypid
(these are available by default in PHP but may have been disabled manually) - The system must provide the following commands:
ps
,awk
(these are available by default in Linux systems) - The
proc
filesystem needs to be mounted at/proc
for theps x
command to work (this is the default on linux systems) - The
which
package needs to be installed and working
Notes:
- this is not supported on Windows
- this is not supported on Synology devices
- in some cases the configuration for web will have these functions disabled (For example if you have different INI files for CLI and web)
You can manually test if Managing processes via CLI is supported by running the following command in your server:
./console diagnostics:run --all | grep -i "processes via cli"
If it returns Setup Cron - Managing processes via CLI: INFORMATIONAL not supported (optional) learn more
then it means that it is not supported yet (even on CLI). To troubleshoot why, and find out how to solve this issue, here are the following commands that should be running (from your terminal or SSH window as the Matomo user) for the diagnostic to display OK:
ps -e
# Should return a list containing PID, TTY, TIME and CMD for ps
awk -V
# Should return the installed version of awk, for example GNU Awk 4.2.1, API: 2.0
ls /proc
# Should return the full contents of the /proc folder
php -r "var_dump(function_exists('shell_exec'));"
php -r "var_dump(function_exists('getmypid'));"
# Should both return bool(true)
which
#should return nothing, if which is not installed it will return "command not found"
#in this case you will need to install the which package from your distributions repository