PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted

Does anyone know where FreePBX hard-codes the amount of memory PHP can use?

I load large Least cost routing tables into my fail-over outbound servers. These boxes have plenty of horsepower and memory, together with a PCIe Plextor SSD. I have just added a new provider for outbound termination with 196,000 additional destinations. I’m now getting memory errors when trying to reload. (You read the above line correctly. This configuration has proven successful for over 6 years with an average of 1/2 million outbound minutes per month with 2 load balanced asterisk/freepbx servers.)
I have further diagnosed that the problem is not in the PHP.INI file, but rather a line coded somewhere in FREEPBX.

[root@localhost ~]# amportal a r

Please wait…

Error(s) have occured, the following is the retrieve_conf output:exit: 255
Added to globals: OPERATOR_XTN =
Added to globals: VM_OPTS =
Added to globals: VM_GAIN =
Added to globals: VM_DDTYPE = u
Added to globals: VMX_OPTS_LOOP =
Added to globals: VMX_OPTS_DOVM =
Added to globals: VMX_TIMEOUT = 2
Added to globals: VMX_REPEAT = 1
Added to globals: VMX_LOOPS = 1
Added to globals: ASTETCDIR = /etc/asterisk
Added to globals: ASTMODDIR = /usr/lib64/asterisk/modules
Added to globals: ASTVARLIBDIR = /var/lib/asterisk
Added to globals: ASTAGIDIR = /var/lib/asterisk/agi-bin
Added to globals: ASTSPOOLDIR = /var/spool/asterisk
Added to globals: ASTRUNDIR = /var/run/asterisk
Added to globals: ASTLOGDIR = /var/log/asterisk
Added to globals: CWINUSEBUSY = true
Added to globals: AMPMGRUSER = admin
Added to globals: AMPMGRPASS =
Added to globals: AMPDBENGINE = mysql
Added to globals: AMPDBHOST = localhost
Added to globals: AMPDBNAME = asterisk
Added to globals: AMPDBUSER = asteriskuser
Added to globals: AMPDBPASS =
Added to globals: VMX_CONTEXT = from-internal
Added to globals: VMX_PRI = 1
Added to globals: VMX_TIMEDEST_CONTEXT =
Added to globals: VMX_TIMEDEST_EXT = dovm
Added to globals: VMX_TIMEDEST_PRI = 1
Added to globals: VMX_LOOPDEST_CONTEXT =
Added to globals: VMX_LOOPDEST_EXT = dovm
Added to globals: VMX_LOOPDEST_PRI = 1
Added to globals: MIXMON_DIR =
Added to globals: MIXMON_POST =
Added to globals: DIAL_OPTIONS = tr
Added to globals: TRUNK_OPTIONS =
Added to globals: TRUNK_RING_TIMER = 300
Added to globals: MIXMON_FORMAT = wav
Added to globals: REC_POLICY = caller
Added to globals: RINGTIMER_DEFAULT = 15
Added to globals: TRANSFER_CONTEXT = from-internal-xfer
PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 240 bytes) in /var/www/html/admin/modules/core/functions.inc.php on line 2263

I modify the PHP.INI as follows
Set memory_limit to 2048M
Set post_max_size to 20M
Set upload_max_filesize to 20M
Max_execution_time to 600 seconds
max_input_time = 600
Somewhere in the Freepbx code, there will be a memory statement eg.

<?php function get_usage_in_kb() { echo memory_get_usage()/1024.0 . " kb \n"; } Can you let me know where is so that FreePBX doesn't ignore my changes to the PHP.INI? Thanks

What version of FreePBX are you using?

Hello Andrew.

fastdrw’s using 2.11.0.42 (Elastix 2.5).

Daniel

We are using FreePBX 2.11.042. This version is compatible with other software we use in conjunction with our billing system.

I asked because a ticket was reopened regarding this however it was fixed in version 13. As for version 2.11 one simply needs to grep for “memory_limit” to find where it’s set.

1 Like