I have a laravel 7 application running on a server (Ubuntu 18.04 LTS, apache2 webserver). My problem is, that php artisan cache:clear does return "Failed to clear cache. Make sure you have the appropriate permissions."
I tried the following approaches without success:
chmod -R 775 storagephp artisan config:cache- manually deleting "bootstrap/cache/services.php" + "bootstrap/cache/packages.php" + "bootstrap/cache/config.php"
New created cache folders in "storage/framework/cache/data" are sometimes owned by user root, this seems to be the problem.
If I delete these folders manually it works till new root folders are created.
With ps -aux I saw that the laravel process was running from user root. I changed this with sudo -u myusername, but this didnt change the behaviour. I am starting the laravel application (php artisan serve) within the rc.local script on server restart.
The current user "myusername" is in the group www-data.