How to increase the PHP memory limit beyond 256MB for adminer on macOS

Issue Summary

I’ve edited /local-site/conf/php/php.ini.hbs, replacing:

memory_limit = 256M

with

memory_limit = 512M,

restarted the website, reloaded adminer, and received the same memory error in adminer when importing a 283MB .sql.zip:

Fatal error : Allowed memory size of 268435456 bytes exhausted (tried to allocate 283531240 bytes) in /Applications/Local.app/Contents/Resources/extraResources/adminer/adminer.php on line 98

Checking phpinfo, I see:

memory_limit 512M

Replication

On macOS, edit /local-site/conf/php/php.ini.hbs, replacing:

memory_limit = 256M

with

memory_limit = 512M,

Load the site’s adminer, try and import a file larger than 256MB, should receive the same error.

System Details

  • Which version of Local is being used? 6.7.1+6369.

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

  • Attach the Local Log.
    local-logs.zip (178.3 KB)

Using the command line to import using mysql resolved this, but it would be nice for adminer to used 512MB if WordPress does.

Hi, this is my first time using LocalWP and I am having the same problem with size.
When I click the WP Admin button, I get the error message (screenshot attached) and cannot go any further.

I am using MacOS Monterey, any help would be appreciated.

Thank you.

Hi @MagentaDigital,

Do you know how to turn on WordPress debug?

This will help you troubleshoot 500 internal server errors on WordPress.

See this article on troubleshooting WP 500 internal server errors.

Sorry @MagentaDigital I misread.

Have you edited:

/users/your-username/your-local-site/conf/php/php.ini.hbs, replacing:

memory_limit = 256M

with

memory_limit = 512M

yet?

Hi @s.doig thank you for replying.
Where can I edit the memory limit?

Thank you

@MagentaDigital

Can you find the file /users/your-username/your-local-site/conf/php/php.ini.hbs?

If so, replace memory_limit = 256M with memory_limit = 512M, save the file, then in Local, start your site if it is not started, then in the Overview tab, PHP Version, click Details:

image

and in the new PHP Info tab, find memory_limit by using CMD+F (Mac) / CTRL+F (Windows/Linux) to bring up the “find” window, and hopefully, it will now say 512M.

If it does, test if your site will load.

Hi @s.doig

No, when I can find the file, I’ve tried to copy it as a Url and even in “Go to site folder” but cannot see where to edit.

I usually just build from Wordpress themes on a server and not good with coding and server back end type of problems.

Your help is really appreciated though

OK @MagentaDigital

You’ll need a code editor to edit the file.

Download Microsoft Visual Code. Choose the zip appropriate for your CPU. Unzip the download, then move Visual Studio Code to /applications in Finder.

Now find /users/your-username/your-local-site/conf/php/php.ini.hbs again, right-click and choose Open With > Visual Studio Code.

Then follow the steps to change from 256M to 512M in my previous post and open PHP Info from Local to confirm your website is now using 512M, if so, see if this resolves your problem.

1 Like

1

I think I have found it , is the the thing that I need to be updating?

Yes, that’s right @MagentaDigital

Screenshot 2023-05-16 at 10.43.30

Good morning,
I have updated the memory limit nad the PHP is 8.1.9 but still getting the same error message when I tried to go to wp-admin and I have added a 2nd screenshot of when I go to ‘open site’.

I am doing a build offline as I am replacing an old website. I tried to use the wp-staging plugin on the existing website but that’s not quite working. I am thinking I will just have to delete the old theme, upload the new but put a landing page up for ‘coming soon’ while it is built, I was just trying to limit the downtime of the website.

Thank you for all your help, very much appreciated.

Good morning @MagentaDigital,

Try the same process of adjusting the memory limit, but change 512M to 1024M.

If you still get a similar error, change 1024M to 1536M, and then 2048M if required.

Regards,
Steve

Hi Steve,

None of them work! I’m lost for ideas now. I think it is a lost cause!
I think I will just have to have downtime on the website while I build of the theme in the back end.

Thanks for all your help and advise.

Phil.

Hi Phil,

OK, one last thing to try is to disable your plugins.

Rename /wp-content/plugins/ to /wp-content/plugins.temp/ then try to login to /wp-admin/

If that works, then re-create the folder /wp-content/plugins/, and move each plugin folder one by one from /wp-content/plugins.temp/ to /wp-content/plugins/, checking each time that /wp-admin/ loads fine.

If /wp-admin/ ever breaks after moving a plugin folder to /wp-content/plugins/, then the last plugin you moved is the culprit, and you should probably contact their support on WordPress Plugins | WordPress.org, and move that folder back to /wp-content/plugins.temp/ and leave it there.

Then move the other plugin folders into /wp-content/plugins/, making sure they don’t break /wp-admin/ either.

If renaming /wp-content/plugins/ to /wp-content/plugins.temp/ didn’t allow you to login to /wp-admin/ then the theme may be causing a problem.

Create a new folder called /wp-content/themes.temp/ and move any non-official-wordpress-themes into that folder.

Official themes are:

  • twentytwentyone
  • twentytwentytwo
  • twentytwentythree

etc.

then try and login to /wp-admin/

If that fails, let me know.

PS - you should always ensure the default index.php found in

  • /wp-content/plugins/, and
  • /wp-content/theme/

is always in any additional temporary folders you create, e.g:

  • /wp-content/plugins.temp/, and
  • /wp-content/theme.temp/

so that the bad guys can’t find any old plugins and themes you’ve left in those temporary folders.

You should not leave any themes or plugins in those temporary folders on a live, online website, anyway, as the bad guys can find specific folders if they’re looking for them without having to list the contents of the temporary folders/directories.

2 Likes

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