1

I am trying to increase the memory limit on my nginx php-fpm server for wordpress. Specifically the Wordpress plugin WooCommerce needs more available memory.

I've set the following in wp-config.php...

define('WP_MEMORY_LIMIT', '128M');
define('WP_MAX_MEMORY_LIMIT', '128M');

php.ini has the following...

memory_limit = 128M
;suhosin.memory_limit = 0

The fpm server is also set to change this.

php_admin_value[memory_limit] = 128M

Yet WooCommerce's system status still claims it only has 40MB, how can this be?

I believe it might be suhosin but I am unsure how to change this on an OpenBSD server. I've tried changing it in the settings for the php-fpm server pool.

php_admin_value[suhosin.memory_limit] = 128M

If someone can tell me how to change the limit on an OpenBSD server that would be very good.

3
  • Did you restart php-fpm? Oct 5, 2013 at 15:42
  • Yes I restarted php-fpm.
    – John Tate
    Oct 5, 2013 at 21:21
  • Could you post the contents of wp-config.php file, excluding DB credentials, salt, and table_prefix? Oct 6, 2013 at 1:24

2 Answers 2

4

One can not re-define a constant (in PHP / WordPress). So, you must have put the line...

define('WP_MEMORY_LIMIT', '128M');

at the end of your wp-config.php file. If you are not already aware, the last default line in this file (require_once(ABSPATH . 'wp-settings.php');) setup all the variables and constants.

In order to solve your issue, you must define 'WP_MEMORY_LIMIT' before WordPress sets its constants. So, the contents (or tail wp-config.php) of your site's wp-config.php file should read like this...

define( 'WP_MEMORY_LIMIT', '128M' );

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

Basically, there is nothing wrong with Nginx or php-fpm. The issue is in where you define a constant for WordPress.

1

As far as I can remember, Wordpress doesn't list available/maximum RAM but allowed upload file size.

You can change that through the upload_max_filesize and post_max_size settings in php.ini or per-pool in your php-fpm.d/*.conf files.

Concerning nginx, remember to set client_max_body_size 128m; to allow for bigger POST data to be sent to/through the webserver.

4
  • This has nothing to do with upload size. The Wordpress plugin WooCommerce lists available memory on it's system status page. I need to increase the max memory.
    – John Tate
    Oct 5, 2013 at 23:27
  • What happens if you go crazy and set memory_limit to 512M or something like that? Make sure there isn't a per-directory php.ini file in effect, overriding the main config. Try momentarily disabling APC as it can show you stale/cached PHP output.
    – Andres B
    Oct 6, 2013 at 0:02
  • I don't seem to have APC installed so it isn't that. There is no php.ini for the users directory.
    – John Tate
    Oct 6, 2013 at 0:59
  • I definitely don't have APC, just confirmed that.
    – John Tate
    Oct 6, 2013 at 1:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .