Hi
I seem to be stumped on a PHP memory_limit exceeded message of which the usual php.ini edits have no use.
I've edited
/usr/local/lib/php.ini
/usr/local/lsws/php/php.ini
Both to memory_limit = 256 and restarted lightspeed but still stuck around max 32-37MB for php ? Is this because php was compiled without memory-limit flag ?
PHPINFO reports 256M memory_limit
configure command
but using test script as well as in drupal 5.19 and vbdrupal 5.19 scripts I am hitting memory_limit at around 32-37MB ??
test script output
phpmemory.php script contents
So is there are php memory limit in litespeed elsewhere that needs editing ? I tried copying php.ini over to /home/username as well and that didn't work either ?
If php needs to be recompiled with memory limit flag, where do I recompile it from litespeed admin for web1 and web2 servers or from WHM easyapache ?
Rest of details:
On WHM/Cpanel 11.25.xx based server with litespeed 4.0.12 on 2x web servers load balanced using haproxy where load balancer ip is xxx.xx.xxx.x13
Both web1 and web2 have:
thanks
George
I seem to be stumped on a PHP memory_limit exceeded message of which the usual php.ini edits have no use.
I've edited
/usr/local/lib/php.ini
/usr/local/lsws/php/php.ini
Both to memory_limit = 256 and restarted lightspeed but still stuck around max 32-37MB for php ? Is this because php was compiled without memory-limit flag ?
PHPINFO reports 256M memory_limit
Code:
memory_limit 256M 256M
./configure --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes --enable-mbstring --enable-pdo=shared --enable-soap --enable-sockets --enable-wddx --enable-zip --prefix=/usr/local --with-bz2 --with-curl=/opt/curlssl/ --with-curlwrappers --with-freetype-dir=/usr --with-gd --with-gettext --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/usr --with-jpeg-dir=/usr --with-kerberos --with-libdir=lib64 --with-libexpat-dir=/usr --with-libxml-dir=/opt/xml2 --with-libxml-dir=/opt/xml2/ --with-mcrypt=/opt/libmcrypt/ --with-mhash=/opt/mhash/ --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-openssl=/usr --with-openssl-dir=/usr --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-pic --with-png-dir=/usr --with-pspell --with-sqlite=shared --with-ttf --with-xmlrpc --with-xpm-dir=/usr --with-xsl=/opt/xslt/ --with-zlib --with-zlib-dir=/usr --with-litespeed
test script output
Expected memory limit 256MB
Base -> 93616 (0.09 MB)
Clear -> 103912 (0.1 MB)
1000 x 10000 chars -> 10104072 (9.64 MB) [15.1 percent]
Clear -> 104096 (0.1 MB)
1500 x 10000 chars -> 15104256 (14.4 MB) [22.5 percent]
Clear -> 104096 (0.1 MB)
2000 x 10000 chars -> 20104256 (19.17 MB) [30 percent]
Clear -> 104096 (0.1 MB)
2500 x 10000 chars -> 25104256 (23.94 MB) [37.4 percent]
Clear -> 104096 (0.1 MB)
3000 x 10000 chars -> 30104256 (28.71 MB) [44.9 percent]
Clear -> 104096 (0.1 MB)
3500 x 10000 chars -> 35104256 (33.48 MB) [52.3 percent]
Clear -> 104096 (0.1 MB)
4000 x 10000 chars ->
Fatal error: Out of memory (allocated 262144) (tried to allocate 40000001 bytes) in /home/username/public_html/phpmemory.php on line 19
Base -> 93616 (0.09 MB)
Clear -> 103912 (0.1 MB)
1000 x 10000 chars -> 10104072 (9.64 MB) [15.1 percent]
Clear -> 104096 (0.1 MB)
1500 x 10000 chars -> 15104256 (14.4 MB) [22.5 percent]
Clear -> 104096 (0.1 MB)
2000 x 10000 chars -> 20104256 (19.17 MB) [30 percent]
Clear -> 104096 (0.1 MB)
2500 x 10000 chars -> 25104256 (23.94 MB) [37.4 percent]
Clear -> 104096 (0.1 MB)
3000 x 10000 chars -> 30104256 (28.71 MB) [44.9 percent]
Clear -> 104096 (0.1 MB)
3500 x 10000 chars -> 35104256 (33.48 MB) [52.3 percent]
Clear -> 104096 (0.1 MB)
4000 x 10000 chars ->
Fatal error: Out of memory (allocated 262144) (tried to allocate 40000001 bytes) in /home/username/public_html/phpmemory.php on line 19
Code:
<?php
// phpmemory.php
$memlimit = 256;
print 'Expected memory limit ' . $memlimit . 'MB <br />';
$memory_mb = round(memory_get_usage() /1024/1024 , 2);
print 'Base -> ' . memory_get_usage() . ' (' . $memory_mb . ' MB)' . ' <br />   <br />';
$pattern = str_repeat("0123456789", 1000);
$fill = str_repeat($pattern, 1);
$counter = 1000;
while ( $counter <= 27000 ) {
unset($fill);
$memory_mb = round(memory_get_usage() /1024/1024 , 2);
print 'Clear -> ' . memory_get_usage() . ' (' . $memory_mb . ' MB) <br />';
print $counter . ' x 10000 chars -> ' ;
$fill = str_repeat($pattern, $counter);
$memory_mb = round(memory_get_usage() /1024/1024 , 2);
print memory_get_usage() . ' (' . $memory_mb . ' MB)'. ' [' . $memory_pct = round($memory_mb /
$memlimit *100 , 1) . ' percent]<br />';
$counter = $counter + 500;
}
print '<br />If you can see this, the server can allocate something close to 256mb';
?>
If php needs to be recompiled with memory limit flag, where do I recompile it from litespeed admin for web1 and web2 servers or from WHM easyapache ?
Rest of details:
On WHM/Cpanel 11.25.xx based server with litespeed 4.0.12 on 2x web servers load balanced using haproxy where load balancer ip is xxx.xx.xxx.x13
Both web1 and web2 have:
- PHP 5.2.12 + Eaccelerator
- Memcached 1.2.8 and Memache 2.2.5 installed
thanks
George
Last edited: