[Plugin: WP-ServerInfo] PHP memory_limit stuck at 256M
-
I’m using WP 3.1 and it seems that the plugin “wp-serverinfo”‘s PHP memory_limit is stuck at 256M.
I have my memory limit set @ 400M but it does not recognize it.
-
If it reads at 256M, means it is 256M as it is reading directly from the config.
wp-config.php = define(‘WP_MEMORY_LIMIT’, ‘400M’);
php.ini = memory_limit = 400M
.htaccess = php_value memory_limit 400M
wp-overview plugin = shows 400M
phpinfo(); = shows 400MWhat config are you taking about? It seems to be fine except this plugin.
I found this thread that states something may have changed in 3.0:
http://ww.wp.xz.cn/support/topic/wp3-exeed-256-memory-limitHmm that is wierd, there is a PHP info as well in WP-ServerInfo. What does it says?
The settings is reading off PHP function. You can do a
<?php echo ini_get('memory_limit'); ?>in a php file and point your browser to it and see what it says. That is the code WP-ServerInfo use.<?php echo ini_get('memory_limit'); ?>also shows the correct 400M.Your plugin is the only one stuck at 256M.
Maybe take a look at what wp-overview(lite) did to update their plugin.
They use
<?php echo WP_MEMORY_LIMIT?>and it worksI changed line 622 from:
echo '<li>'. __('Memory Limit', 'wp-serverinfo').': <strong>'.format_php_size(get_php_memory_limit()).'</strong></li>';to
echo '<li>'. __('Memory Limit', 'wp-serverinfo').': <strong>'.WP_MEMORY_LIMIT.'</strong></li>';and it still shows 256M so there is something else in your plugin.
It has to be something with 3.# multi site’s way of looking it up
Doh!
I found another place, line 144
changed
<td><?php echo format_php_size(get_php_memory_limit()); ?></td>to
<td><?php echo WP_MEMORY_LIMIT; ?></td>and tada, it works now!
That is weird, I can’t reproduce this problem on my end. I tried 400M and it works for me.
The only difference is that I formatted the output after reading it.
Could you try this piece of code for me?
<?php
function format_filesize($rawSize) {
if($rawSize / 1099511627776 > 1) {
return number_format($rawSize/1099511627776, 1).' TiB';
} elseif($rawSize / 1073741824 > 1) {
return number_format($rawSize/1073741824, 1).' GiB';
} elseif($rawSize / 1048576 > 1) {
return number_format($rawSize/1048576, 1).' MiB';
} elseif($rawSize / 1024 > 1) {
return number_format($rawSize/1024, 1).' KiB';
} elseif($rawSize > 1) {
return number_format($rawSize, 0).' bytes';
} else {
return 'unknown';
}
}
function format_php_size($size) {
if (!is_numeric($size)) {
if (strpos($size, 'M') !== false) {
$size = intval($size)*1024*1024;
} elseif (strpos($size, 'K') !== false) {
$size = intval($size)*1024;
} elseif (strpos($size, 'G') !== false) {
$size = intval($size)*1024*1024*1024;
}
}
return is_numeric($size) ? format_filesize($size) : $size;
}echo format_php_size(ini_get('memory_limit'));
?>That returns “400.0 MiB” 🙂
Are you testing on a multi-site installation?
That thread I posted before hints at that as the source.
Weird, nope I am testing on a single installation. I have not tested and used WPMU before =p
I changed the 2 core files in the patch to show 400M instead of 256M and that still didn’t fix it.
TADA,
/wp-admin/admin.php
line 109
@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', '256M' ) );I changed that and now it works 🙂
The topic ‘[Plugin: WP-ServerInfo] PHP memory_limit stuck at 256M’ is closed to new replies.