Unable to set Php Max Memory Limit


#1

Hello there!

When checking the woocommerce system status page, it tells me that my website is allowed to use 40 MB max memory for php scripts.

However I set the max memory to 1024MB in /etc/php5/fpm/php.ini like so memory_limit = 1024M

I restarted php by running restart php5-fpm and just in case also restarted nginx.

I also added the max memory definition line to my wp-config.php: define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ );

However also after clearing caches and all the status page still tells me that only 40 MB are allowed to use. I set up a second server for a client and over there the settings work just fine. What could be the culprit on my own server?

Any help appreciated!

Sas


#2

You create a .user.ini file in htdocs folder, and put what you want into it.

And you must add define( ‘WP_MAX_MEMORY_LIMIT’, ‘64M’ ); before “Stop…” in wp-config.php

Max php memory limit in EE setting is 128MB.


#3

Hi hiepbg!

Thanks for your answer!

  1. Added a .user.ini however this isn’t really necessary. I know that since php version 5.3 there is the directory based possiblity to add a user.ini to a certan directory to have special php.ini settings installed, but the global settings from /etc/php5/fpm/php.ini should still apply, when not using a user.ini.

  2. As stated in my initial post, I added that deifinition line in my wp-config.php already.

  3. Which ee settings do you mean? Which file would that be? Thanks for answering!


#4

I fixed it. Somehow there was a small typo in my wp-config.php that had slipped through although double- and triplechecking entries… To get the correct memory limit set correctly you should use define( ‘WP_MEMORY_LIMIT’, ‘512M’ );

instead of

define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ );

Thanks for help!