Fixes for the permission errors most commonly hit when running Dotkernel Light for the first time.
If running your project you encounter some permission issues, follow the below steps.
PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/example.local/html/data" is not writable...
PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/example.local/html/data/cache" is not writable...
Fix: give the web-server user write access through the group, rather than opening the folder to everyone.
sudo chown -R "$USER":www-data data
sudo chmod -R 775 data
PHP Fatal error: Uncaught ErrorException: fopen(/var/www/example.local/config/autoload/../../log/error-log-yyyy-mm-dd.log): Failed to open stream: Permission denied...
Fix:
sudo chown -R "$USER":www-data log
sudo chmod -R 775 log
Replace
www-datawith the user your web server runs as if it differs — it isapacheon AlmaLinux and RHEL derivatives, andnginxwhere nginx runs the worker processes.
chmod -R 777is sometimes suggested for these folders. Avoid it outside a throwaway local VM: it lets anything on the machine rewrite the Twig and config caches, and those are executable PHP.