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:
- At a high-level, Local will start a containerized environment,
- A containerized environment will have its own set of configuration every single time it starts
- 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.
The most apparent change with Local “Lightning” is speed. Local launches instantly (think three seconds instead of three minutes) and wp-admin loads faster than anywhere else. (Yep, even faster than Flywheel!) This makes starting your work or beginning to write code a whole lot faster. What’s Local by Flywheel? Local by Flywheel is a free software that lets you host WordPress locally on your PC. Windows and Mac. You get a one-click WordPress installation in the software just as you do if you were in your cpanel with softaculous.
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
Local Flywheel Wordpress
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 Flywheel Import Site
- 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.