Kim Stacks
Kim Stacks

Reputation: 10812

how to configure debug mode for production environment in Cake 3.2?

The latest Cake will produce this inside the app.php

'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),

I need to set up for production use.

How do I make it debug false on production server without changing this?

Upvotes: 0

Views: 2844

Answers (1)

Sevvlor
Sevvlor

Reputation: 560

Apache

You can set the Environment DEBUG value to false via the .htaccess on the production server. You'll just have to add SetEnv DEBUG false to the .htaccess file you're using.

This StackOverflow post explains it a little more.

Nginx

If you are using Nginx you can set environment values in two different ways.

You can add an extra fastcgi_param to the locationblock with the desired name and value:

location / {
    ...
    fastcgi_param DEBUG false; 
    ...
}

php-fpm

You also can configure the php-fpm or the php-cgi config and add the following:

env[DEBUG] = false

According to CakePHP's documentation the env() requires one parameter, they environment value key. The second parameter is optional and a default, in case the value isn't set.

Upvotes: 2

Related Questions