FreePBX 13 reload error

When I run a fwconsole reload I get the following output:
Reloading FreePBX
Error(s) have occured, the following is the retrieve_conf output:
exit: 255
PHP Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 196017 bytes) in /var/www/html/admin/libraries/php-asmanager.php on line 304
Whoops\Exception\ErrorException: Allowed memory size of 262144 bytes exhausted (tried to allocate 196017 bytes) in file /var/www/html/admin/libraries/php-asmanager.php on line 304
Stack trace:

  1. () /var/www/html/admin/libraries/php-asmanager.php:304

In phpinfo() it shows my php memory limit is set to 1GB
memory_limit 1024M 1024M

I also have 4GB free ram on the system. Not sure why it’s acting up on this reload.

This is on FreePBX 13.0.192.19
PBX Firmware:10.13.66-20

All modules up to date

You need to check phpinfo from the cli.

#php -i | grep memory
memory_limit => 1024M => 1024M
PHP Warning: Unknown: It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/New_York’ for ‘EDT/-4.0/DST’ instead in Unknown on line 0

Something has set your memory limit to 256mb internally. Unsure where or why thats happening.

That’s the thing, it’s giving the 256 KB that it has if there’s a bad option, and we have nothing running on this outside of FreePBX standard modules and Asternic CDR.

Memory limit is set during retrieve_conf based on the amount of memory in your system.

If you know PHP you can try seeing what it’s saying by modifying the lines around this area:

cat /proc/meminfo

I don’t really know PHP, but mine looks the same as what you have there.

output of meminfo

 cat /proc/meminfo
MemTotal:        8388608 kB
MemFree:         4159960 kB
Cached:          2905228 kB
Buffers:               0 kB
Active:          2381920 kB
Inactive:        1361416 kB
Active(anon):     799860 kB
Inactive(anon):    80480 kB
Active(file):    1582060 kB
Inactive(file):  1280936 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       4194304 kB
SwapFree:        4079372 kB
Dirty:              1664 kB
Writeback:             0 kB
AnonPages:        880340 kB
Shmem:             42232 kB
Slab:             485308 kB
SReclaimable:     464532 kB
SUnreclaim:        20776 kB

It appears to be setting fine. I am at a loss at to why this is happening to you.

Ok, so next question to go with it, will it apply (or give me issues) if I just restart asterisk with fwconsole?

All I really care about right now is applying this, so I can get the new guy a working phone, but this system is slated for full replacement in the next 60 days as is.

So it won’t work

Locate retrieve_conf

Edit the file, insert after line 20:
ini_set(‘memory_limit’,‘-1’);

1 Like

Added that in, got this again.

Error(s) have occured, the following is the retrieve_conf output:
exit: 255
PHP Fatal error:  Allowed memory size of 262144 bytes 
exhausted (tried to allocate 196017 bytes) in 
/var/www/html/admin/libraries/php-asmanager.php on line 304
Whoops\Exception\ErrorException: Allowed memory size of 
262144 bytes exhausted (tried to allocate 196017 bytes) in file 
/var/www/html/admin/libraries/php-asmanager.php on line 304
Stack trace:
  1. () /var/www/html/admin/libraries/php-asmanager.php:304

That block currently looks like this

$meminfo = getSystemMemInfo();
if(!empty($meminfo['MemTotal'])) {
        $memt = preg_replace("/\D/","",$meminfo['MemTotal']);
        ini_set('memory_limit',$memt.'K');
} else {
        $memt = 0;
        ini_set('memory_limit','-1');
}

You put it in the wrong place. AFTER line 20 (if you look at the code above then you should be using those line numbers)

Sorry about that. It reloaded. Thank you for your help.

Can you do me a favor.

Right after

$memt = preg_replace("/\D/","",$meminfo['MemTotal']);

Insert:

print_r($memt);

Then run:

/var/lib/asterisk/bin/retrieve_conf

Post output here.

$ /var/lib/asterisk/bin/retrieve_conf
8388608Please update your modules and reload Asterisk by browsing to your server.

Which would set

ini_set('memory_limit','8388608K');

Curious why that isnt working on your system. Though I don’t think we even need to set anything but unlimited here.

Not sure. Either way, it’s going away in 60 days or less, so I’m just at the point I need to get through that and power it off once it’s all done.

I’m glad it’s reloading now though so thanks for the help.