How to increase the PHP memory limit beyond 256MB for memory-intensive websites

Issue Summary

I’ve tried setting the PHP memory limit to 1024 MB through:

  • wp-config.php
  • .htaccess
  • php.ini

to allow my memory-intensive WP website to function properly, but /local-phpinfo.php says the memory limit is hard-coded @ 256MB.

Why is there this artificial limit?

Are we unable to run WP websites which require more than 256MB?

Troubleshooting Questions

  • Happens for all sites in Local

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser? Yes

System Details

  • Which version of Local is being used? 6.4.3.

  • What Operating System (OS) and OS version is being used?

    • Windows 11 Pro 64-bit.
  • Attach the Local Log. See this Help Doc for instructions on how to do so:

Hi @s.doig!

These values can be edited in the php.ini.hbs file within the site’s conf/php/ folder. You can open this file in the text editor of your choice, and save the updated values. After making any adjustments, be sure to stop the site and restart it so that Local can compile and use those new settings.

Check here for more Local performance troubleshooting if needed!

Hi Nick,

I’ve made the adjustment to this file, restarted the Local server, and the memory limit remains @ 256M.

Hi @s.doig - sometimes on Windows machines we see security, antivirus or firewall applications blocking Local actions. Would there be anything on your end that could be hampering it?

For troubleshooting this further, you may want to take a look at this help doc: What is Router Mode? - Local

If you’re still having problems, can you share a copy of your log here? Retrieving Local’s Log File

Hi @Nick-B

I don’t think anything is blocking local actions.

Attached are the local logs.

local-logs.zip (79.7 KB)

Hi @s.doig - I’m still seeing some errors like your other thread over here: Site creation issue: "command failed...missing --admin_email parameter"

Have you changed your email and password to remove any invalid characters?

Hi @Nick-B

I have no problem with my admin account email or password.

Hi @s.doig I know you mentioned that “I don’t think anything is blocking local actions.” but taking another look at the logs I’m seeing that something might indeed be blocking. An attempt was made to access a socket in a way forbidden by its access

You may want to refer to this guide to try changing your Router Mode, or troubleshooting any port conflicts caused by security applications or other dev tools. What is Router Mode? - Local

Hi @Nick-B

The date of that error is 2022/10/19, 8 days ago.

It has not occurred since then.

Hi @s.doig if that is the case and you’re still unable to save memory changes then you may need to try a more aggressive reset.

  • Export any sites that you have on Local and save them to a folder somewhere on your computer.

  • Fully uninstall Local from your computer.

  • Install the latest version of Local on this link.

  • Once installed, please restart the computer.

  • When the computer is restarted and turned on, close any applications that automatically run in the background (AntiVirus, Firewall, and other Developer applications included).

  • Check and see if the issue still persists.

I just replicated the steps to change memory on my Local App, and it’s still working normally for the latest version. These steps again are:

  • Start Site
  • Open php.ini.hbs file in a text editor
  • Adjust the memory to desired limit, save file
  • Stop the site
  • Start the site again
  • Recheck the file and the changes should still be present

Before I do that, @Nick-B, how large are you able to set the memory limit to? Is it larger than 256MB?

Hi @s.doig - yes you should be able to set it to whatever you would like. You’re not limited by the Local App but by your own machine. I’ve tested it this on my own app and had no problem setting it to 512MB for example.

My bad… I edited the php.ini.hbs in the php version folder, not the php folder. Editing the latter is the correct way :slight_smile:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.