If you’re using Local by Flywheel to work on your projects, there may be times where you need to make customizations to the PHP configuration when the site starts.

Before getting started, note the following:

  1. At a high-level, Local will start a containerized environment,
  2. A containerized environment will have its own set of configuration every single time it starts
  3. This means that you cannot change any configuration to the OS-level installation to achieve the changes you need.

So what do we do?

Change Local PHP Settings

For example, say that you need to manage the memory_limit in PHP that runs for your current site. At the time of this article, the default memory limit is 256MB.

Depending on the size of your project, this could be too low. Instead, locate the following directory:

/Users/[your user name]/[your local directory]/[your site directory]/conf/php

Then find the following file:

php.ini.hbs

Open the file in your preferred editor and change the value for memory_limit to whatever you need (like 1024M 😅) then restart your site.

The amount of allocated memory should be changed from 256MB to a 1GB. To verify this, set up a file with a single call to phpinfo() and then view it in your editor.

Some Details

  • Local configuration files in the hbs format are in Handlebars templates.
  • Local uses the PHP configuration for a given site based on the settings of the php.ini.hbs file – nothing you change at the system level will change this.
  • Random, fun(?) fact: Local was once Pressmatic that I covered several times when it first came out.