Koozali.org: home of the SME Server
Obsolete Releases => SME 9.x Contribs => Topic started by: brianr on July 25, 2017, 12:11:17 PM
-
I am running a rather heavy php program at the command prompt. It runs fine under the default php (5.3.3), but when I run it under php71 (installing using the SCL contrib) it runs out of memory, giving me this:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in ....
where do I increase the memory allowed for php71?
Cheers Brian
-
php.ini is in /etc/opt/remi/php71/php.ini (which uses templates in Stéphane's contrib), but you can override it on the command line if needed:
php71 -dmemory_limit=512M /path/to/my_script.php
-
PHP_Software_Collections#Usage (https://wiki.contribs.org/PHP_Software_Collections#Usage) implies that there is a db variable you use to set the MemoryLimit set for PHP71
[root@sme9b3dev64 ~]# config show php71
php71=configuration
AllowUrlFopen=Off #(On/Off)
MaxExecutionTime=30
MaxFileUpload=20
MaxInputTime=60
MemoryLimit=128M
PhpModule=disabled #(enabled/disabled)
PostMaxSize=20M
UploadMaxFilesize=10M
-
PHP_Software_Collections#Usage (https://wiki.contribs.org/PHP_Software_Collections#Usage) implies that there is a db variable you use to set the MemoryLimit set for PHP71
I'm not seeing the template for the php71 php.ini in /etc/e-smith/templates, is it somewhere else? or perhaps there is another action that translates the db variables into the php71 php.ini?
-
Looks like templates are in /etc/e-smith/templates/opt/remi/php71/root/etc/php.ini
-
Looks like templates are in /etc/e-smith/templates/opt/remi/php71/root/etc/php.ini
so they are - thanks.
-
for the record, here is how to change the memory_limit for php71:
# config setprop php71 MemoryLimit 1500M
# expand-template /opt/remi/php71/root/etc/php.ini
# cat /etc/opt/remi/php71/php.ini | grep -i mem
memory_limit = 1500M
report_memleaks = On
-
This is only if you want to set this limit that high for everything. If you just need to rise the limit for a script, called from the command line, I still advise to set the override like this:
php71 -dmemory_limit=1500M /path/to/script.php
This way, standard PHP scripts ran by apache are still limited to a more reasonable value
-
This is only if you want to set this limit that high for everything. If you just need to rise the limit for a script, called from the command line, I still advise to set the override like this:
php71 -dmemory_limit=1500M /path/to/script.php
This way, standard PHP scripts ran by apache are still limited to a more reasonable value
yes I can quite see that.