When an .env value containing spaces is left unquoted, Dotenv parsing may fail. If PHP error display is disabled in production, the visitor may only see a blank page or HTTP 500.
APP_NAME=Axu Tours
PHP Fatal error: Uncaught Dotenv\Exception\InvalidFileException
HTTP/1.1 500 Internal Server Error
Laravel documentation requires environment values containing spaces to be enclosed in double quotes. Dotenv throws during application bootstrap; when PHP display_errors is disabled, the exception is not printed and the failure looks like a blank page.
The value contains a space but is not quoted.
APP_NAME=Axu ToursAPP_NAME="Axu Tours"An inline note may be confused with the value; keeping comments on separate lines is safer.
APP_URL=https://ornek.com # canlıAPP_URL="https://ornek.com"Do not display production errors, but always log them.
display_errors=Off
log_errors=Offdisplay_errors=Off
log_errors=On
error_log=/var/log/php/error.logShows recent exceptions when the application can initialize logging.
tail -n 150 storage/logs/laravel.log
tail -f storage/logs/laravel.log
If Dotenv fails before Laravel logging starts, the error appears here.
journalctl -u php8.3-fpm -n 100 --no-pager
tail -n 100 /var/log/nginx/error.log
tail -n 100 /usr/local/apache/logs/error_log
The CLI reports the exception directly when the file syntax is invalid.
php -r 'require "vendor/autoload.php"; Dotenv\Dotenv::createImmutable(getcwd())->load(); echo "ENV OK\n";'
Prevents stale cached configuration from masking the corrected value.
php artisan optimize:clear
php artisan config:clear
php artisan about --only=environment
Back up the .env file over FTP or SSH.
Identify values containing spaces, #, quotes, equals signs or line breaks.
Wrap values such as APP_NAME in double quotes.
Run optimize:clear if Artisan can boot.
If HTTP 500 remains, inspect PHP-FPM, Apache or Nginx error logs.
After resolving the issue, use APP_DEBUG=false and log_errors=On.
Unquoted spaces, an unclosed quote or a malformed line.
A bootstrap exception is hidden from the response.
.env fails before the framework can boot.
Configuration cache still contains the old value.
No matching error was found.
Laravel documentation specifies double quotes when the value contains spaces. Quotes are not mandatory for a single word.
Only temporarily in a secured development environment. In production, inspect logs and keep APP_DEBUG=false.
Correct .env directly and run the Dotenv parsing test with PHP CLI.
We implement permanent fixes by reviewing Laravel, PHP-FPM, Nginx, Apache, MySQL, cPanel and Plesk layers together with their logs.