Change default memory_limit size

How can we change the default (system-wide for all sites) memory_limit value?

Changing the value in /etc/php/7.2/cli/php.ini seems to have no effect.

Adding a php_admin_value[memory_limit] =
value in /opt/easyengine/services/nginx-proxy/conf.d/default.conf also seems to have no effect.

and lastly, declaring
define( ‘WP_MEMORY_LIMIT’, ’ ??M ’ );
in wp-config.php seems to have no effect either (where ??M is actually a size).

I’d like to change the system default so I don’t need to modify each site.


wp-includes/default-constants.php. edit this file.

The PHP config is site specific. I don’t know about the global default config for it, because looking at the folder structure every site has its own container, and the default configs are fed from EE. It would be nice in future to be able to specify in the EE config file how much RAM to give service per site by default. Like php, redis etc. Here’s the path per site anyway.


Edit the custom.ini file with what you want. Memory limit, execution time etc and then restart your site.


Never edit WP core files!

@Anisur_Rahman - @EyesX is right, you should never edit core files. Not only will you lose changes when an update happens, but you could create vulnerabilities, performance issues, or who knows what.

@msarhan - Thank you. That did the trick for the site, but I’m still hopeful I can change the default.

I found that the custom.ini comes from here:
but I can’t find where this is stored on the system to then be deployed.

@kirtan - is this downloaded from github each time a site is deployed? And if so, is there a way to someway automate changing the file contents?

Many thanks all,