This page solves the most common first-run errors, which come from the web server not being able to write to the data, public/uploads and log folders.
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...
PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/example.local/html/data/cache/doctrine" is not writable...
Fix:
chmod -R 777 data
PHP Fatal error: Uncaught InvalidArgumentException: The directory "/var/www/example.local/html/public/uploads" is not writable...
Fix:
chmod -R 777 public/uploads
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:
chmod -R 777 log
chmod -R 777 safe on a production server?A: No. It lets every user on the server write to these folders.
In production, give ownership of data, public/uploads and log to the web server user and grant write access only to that user.
A: In log/error-log-{Y}-{m}-{d}.log, one JSON-formatted file per day, as set in config/autoload/error-handling.global.php.
A: Remove the cached configuration with php bin/clear-config-cache.php (or composer clear-config-cache).
While data/cache/config-cache.php exists, it is loaded instead of your configuration files.