In .env file I have export DEBUG="true"
, in app.php I have 'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),
and in app_local.php I have 'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),
but is not showing the errors in the page, it only shows HTTP ERROR 500, how can I solve this issue?
Check your webserver (apache, nginx, etc) logs. Usually in /var/logs/
(ubuntu) folder
Are you definitely importing the .env
file?
I have no idea, I am using the default configuration that is created with composer create-project, how do I have to do to import the .env file?
From Configuration - 4.x
For local development, CakePHP leverages dotenv to make local development automatically reload environment variables. Use composer to require this library and then there is a block of code in bootstrap.php
that needs to be uncommented to harness it.
Is this the code that I have to uncomment in bootstrap.php?
if (!env('APP_NAME') && file_exists(CONFIG . '.env')) {
$dotenv = new \josegonzalez\Dotenv\Loader([CONFIG . '.env']);
$dotenv->parse()
->putenv()
->toEnv()
->toServer();
}
Yes, that’s it. If you already have that uncommented, then you’ll need to investigate:
- Is it actually getting to that point in the bootstrap, or is the error happening before that?
- If it gets there, what’s the value of
env('DEBUG')
both right after that bit executes and when yourapp.php
gets called?
Is not getting to bootstarp.php I put debug(env('DEBUG'));
after the call to $dotenv->parse()->putenv()->toEnv()->toServer();
and is showing the HTTP ERROR 500 page
I could see the error_log file for the site, it says that I have to enable the intl extension in php.
Do you know how to do that?
Thank you @Zuluru I could solve it, it was a little tricky, but finally could activate the intl extension in the server