Bug? - Caching Issues

eramba relies on caching to make things more or less quick, that is why the first load on anything can take much longer than subsequent loads.

caching is nothing more than a few files on the directory app/tmp/cache/* (there are many types of files here) … since we use CLI when the daily and hourly cron process runs they touch this caches and since root is most of the time running them the cache files get updated as “root” instead of the apache user.

when you then try to use eramba, on the error log you will see something like this:

Warning: Warning (512): SplFileInfo::openFile(/data/www/app/tmp/cache/persistent/eramba_cake_core_cake_eng) [<a href='http://php.net/splfileinfo.openfile'>splfileinfo.openfile</a>]: failed to open stream: Permission denied in [/data/www/lib/Cake/Cache/Engine/FileEngine.php, line 360]

That means apache could not longer load the cache files (because is owned by root now) and therefore there is no more caching for you. If you are a system administrator i suggest you change the way you call crons and sudo to your apache user:

su -s /bin/bash -c "/data/apache/eramba_v2/app/Console/cake cron job daily" www-data

This should correct the problem…

int ref: https://github.com/eramba/eramba_v2/issues/2321

I ran into this issue when CLI was first released. I wasn’t able to use su -s because authentication would fail for www-data since it’s a system created account that I don’t have the credentials for. I ended up using this command:

sudo -u www-data "/var/www/html/eramba_v2/app/Console/cake" cron job hourly

Fixed in 2.7 release.