Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

matthiascw's avatar

Disable sql_mode on Forge for a particular application

I have installed an old app on my forge server and according to that topic Disable MySQL Strict Mode on Forge I was able to disable sql_mode globally so that the old app can run its sql queries.

But there are many other apps installed on the server and I do not want to change the mysql settings for all of them. I know it is possible to change the modes for a particular laravel app but for the old application I am missing this feature.

Is there a way to add those mysql configs (sql_mode='') to only a particular installed app on forge?

0 likes
4 replies
shez1983's avatar

is this a setting in config/database where you can disable/enable strict mode.

Cronix's avatar
Cronix
Best Answer
Level 67

@matthiascw Sure, you just set it true/false in /config/database.php for the connection on a per-app basis. You don't need to mess with the actual server settings at all!

        'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true, // right here - it's enabled by default
            'engine' => null,
        ],

https://github.com/laravel/laravel/blob/master/config/database.php#L55

1 like
shez1983's avatar

next time i will spoon feed you @matthiascw the answer.. even better write the whole project for you! getting quite irritating this..

matthiascw's avatar

@shez1983 Having a bad day? Anyway thank you too for your answer. I had to choose the best answer not the fastest one.

Please or to participate in this conversation.