Skip to main content
PHP Blog

Back to all posts

How to Add Custom Ini_set In Laravel?

Published on
4 min read
How to Add Custom Ini_set In Laravel? image

Best PHP Configuration Tools to Buy in October 2025

1 PHP Team Development

PHP Team Development

BUY & SAVE
$38.99
PHP Team Development
2 iFixit Jimmy - Ultimate Electronics Prying & Opening Tool

iFixit Jimmy - Ultimate Electronics Prying & Opening Tool

  • VERSATILE TOOL FOR ALL YOUR TECH AND HOME PROJECTS!
  • ERGONOMIC DESIGN ENSURES COMFORTABLE, PRECISE USE!
  • LIFETIME WARRANTY: REPAIR CONFIDENTLY WITH IFIXIT'S GUARANTEE!
BUY & SAVE
$7.95
iFixit Jimmy - Ultimate Electronics Prying & Opening Tool
+
ONE MORE?

To add custom ini_set in Laravel, you can make use of the ini_set() function in your Laravel application. You can add custom ini settings by defining them in your bootstrap/app.php file. Simply add the ini_set() function with the desired configuration key and value before the application is created. This will ensure that your custom ini settings are applied globally throughout your Laravel application. For example, you can add custom ini settings such as memory_limit or max_execution_time to optimize the performance of your Laravel application.

How to update ini_set values for specific Laravel environments?

To update ini_set values for specific Laravel environments, you can make use of the config directory and environment-specific configuration files in Laravel.

Here's how you can do it:

  1. Create a new configuration file for the specific environment within the config directory. For example, if you want to update ini_set values for the local environment, create a new file named local.php within the config directory.
  2. Within this new configuration file, define the ini_set values that you want to update for the specific environment. For example, you can define the values like this:

return [ 'ini_set_values' => [ 'memory_limit' => '256M', // Add more ini_set values here ] ];

  1. Next, you need to load this configuration file based on the specific environment. You can do this by updating the app.php configuration file within the config directory. Update the app.php file to load the environment-specific configuration file based on the current environment.

For example, update the app.php file to load the local.php configuration file when the APP_ENV environment variable is set to local: