• Hi,
    I added
    define('WP_MEMORY_LIMIT', '512M');
    right after

    define('WP_DEBUG', false);

    I also added
    memory_limit = 512M
    in my php.ini.

    Using phpinfo() memory_limit is = 512M both in Local Value and in Master Value.

    But in WordPress the limit is still 128M.
    Any idea? Thank you.

Viewing 15 replies - 1 through 15 (of 17 total)
  • I think your phpinfo give you the right result.

    And how to display memory limit in wordpress? Do you using custom plugin?

    Do you clear your cache?

    Thread Starter Ciao121

    (@ciao121)

    Yes I cleared my cache.

    I display WP limit value from a pluging debugger. It uses ini_get( ‘memory_limit’ ). Don’t know if phpinfo() uses does it same way.
    I think it’s related to my hosting CP (IspConfig). I’m going to try php ini edits directly.

    And this is for sure the value WP is using (because I get “Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes)” errors).

    Moderator t-p

    (@t-p)

    I think it’s related to my hosting CP (IspConfig).

    Have asked your hosting provider if there is a limit on memory for your account?

    Thread Starter Ciao121

    (@ciao121)

    It’s a dedicated server. I manage it.

    It seems (strange) like wordpress is loading settings from a different php.ini than phpinfo(). I’m looking for a way to get the php.ini file used inside wordpress (ifit is possible it uses a different one…)

    Try using this solution. Copy and paste thie below code into htaccess in your root file.

    php_value memory_limit 512M

    Wait… you get memory exhausted from DS (dedicated server)? How much RAM do you have?

    How many unique visitor /day do you have? Can you copy paste the full error message? I need to know the error come from plugin or … ???

    Thread Starter Ciao121

    (@ciao121)

    I have 32 GB. It happens with a newsletter plugin. I think it happens when it tries to build the email to sens queue. Maybe becaue many users (I have > 100.000).

    [Mon Feb 08 19:09:59.584654 2016] [fcgid:warn] [pid 10971] [client 87.11.220.121:59960] mod_fcgid: stderr: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /var/www/clients/client1/web1/web/wordpress/wp-content/plugins/myMail/classes/queue.class.php on line 121.

    Tried .htaccess tip but didn’t worked

    Thread Starter Ciao121

    (@ciao121)

    This is really driving me crazy ??
    phpinfo tells me:
    Configuration File (php.ini) Path: /etc/php5/cgi
    Loaded Configuration File: /var/www/conf/web1/php.ini
    Tried to change memory_limit in both but wordpress always uses 128.

    More than 100k. Wow, you have so many user.

    If you can increase your memory limit. That still useless. Because your server very busy (just like you DOS your self) and that the cause of ur error.

    Solution:
    1. If you can you must limit to send the email in minute. Example: 100 mails in 1 minute.
    2. if you can, change fast cgi become cgi. (UPDATE: Oh i see you already using CGI)

    Try this in your htaccess file:

    <IfModule mod_php5.c>
    php_value memory_limit 512M
    </IfModule>
    Thread Starter Ciao121

    (@ciao121)

    I don’t think it’s not related to sending rate. The error shows up with no email been sent. Anywy actual setting is very low (30 mail per minute). And I used it with 30.000 email with no problem. I think it’s related to the initial queueing with >100.000 receivers.

    I tried another thing; I have a plugin that I allow to execute php in a page/post.
    I made a single page that only executes phpinfo(). Everything is like the standalone phpinfo. BUT again, memory_limit LOCAL VALUE is 128 if executed in the wordpress page and 512 in the standalone version.

    Tried also
    <IfModule mod_php5.c>
    php_value memory_limit 512M
    </IfModule>

    But no luck :/

    The error shows up with no email been sent.

    I think you should test. You server still can send email or not (maybe so much pending queue). I create this simple script (php) for test.

    Url: https://pastebin.com/QviYxA50
    Note: change [email protected] with your gmail email.

    ***

    Okay. That good if you just send 30 mail per minute.

    Now open your mail log. And can you copy paste the error message in here?

    Thread Starter Ciao121

    (@ciao121)

    Yes, wordpress can send email. Anyway I tried your script and email was succesfully sent. So I have no error in email log. I just have sent confirmation:
    “Feb 8 21:06:08 xxxxxxxxxx postfix/smtp[24258]: AA341A02CF: to=<[email protected]>, relay=smtp-in.xxxxxx.it[xxx.xxx.xxx.xxx]:25, delay=0.78, delays=0.09/0/0.17/0.53, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 2CCFD251474)”

    I don’t think the error is related to the plugin. The problem is why isn’t WP taking my memory limit changes? O_o

    Thread Starter Ciao121

    (@ciao121)

    FIND OUT!!!!
    I’m using a plugin that has those lines:

    if(! defined('WORDFENCE_VERSIONONLY_MODE')){ //Used to get version from file.
    	if((int) @ini_get('memory_limit') < 128){
    		if(strpos(ini_get('disable_functions'), 'ini_set') === false){
    			@ini_set('memory_limit', '128M'); //Some hosts have ini set at as little as 32 megs. 64 is the min sane amount of memory.
    		}
    	}
    	require_once('lib/wordfenceConstants.php');
    	require_once('lib/wordfenceClass.php');
    	wordfence::install_actions();
    }

    For some reason I’ll find, @ini_set(‘memory_limit’, ‘128M’) is fired also if @ini_get(‘memory_limit’) > 128)…

    If everything work fine. Yes, you are right, that is not related to the plugin.

    This is very strange. Why your memory limit don’t changes in wordpress site ??

    Maybe this is the latest solution from me. Try deactivate all your plugin. After that test it. And what the result?

    Yesssssssssss, that is good if you find the solution ??

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘WP_MEMORY_LIMIT not applied’ is closed to new replies.