Feature #13377
closedOption to configure a custom value for the PHP memory limit
100%
Description
There are several cases where the default memory limit used for PHP is being hit and where the system has plenty of extra RAM. In these cases, it would make sense to be able to adjust the limit as needed.
For instance, with an extremely large status_output, a large number of nested aliases, etc.
Files
Updated by Christopher Cope over 2 years ago
- File 0001-Add-a-setting-for-PHP-memory-limit-in-System-Advance.patch 0001-Add-a-setting-for-PHP-memory-limit-in-System-Advance.patch added
- Status changed from New to Pull Request Review
Updated by Lev Prokofev over 2 years ago
- File clipboard-202207290952-dkowf.png clipboard-202207290952-dkowf.png added
- File clipboard-202207290955-aiguw.png clipboard-202207290955-aiguw.png added
- File clipboard-202207290956-o6kwf.png clipboard-202207290956-o6kwf.png added
Seems no changes,
Set 256M
Reboot,
checked with
echo ini_get("memory_limit");
Updated by Christopher Cope over 2 years ago
The change only applies to the PHP used directly by pfSense, as they are set with config.inc.
For testing you can use
<?php require_once("/etc/inc/config.inc"); echo ini_get("memory_limit"); ?>
That inc will be loaded automatically inside pfSense. Also there is no need for a reboot for it to take effect.
Updated by Lev Prokofev over 2 years ago
Got it and checked, working as expected.
Updated by Jim Pingle over 2 years ago
- Subject changed from Allow adjusting the PHP memory_limit in System -> Advanced to Option to configure a custom value for the PHP memory limit
- Target version set to 2.7.0
- Plus Target Version set to 22.11
Updated by Jim Pingle about 2 years ago
- Plus Target Version changed from 22.11 to 23.01
Updated by Jim Pingle about 2 years ago
- Plus Target Version changed from 23.01 to 23.05
Updated by Jim Pingle over 1 year ago
- Plus Target Version changed from 23.05 to 23.09
Updated by Jim Pingle over 1 year ago
- Target version changed from 2.7.0 to CE-Next
Updated by Jonathan Lee over 1 year ago
Could this also be adapted to use a disk swap? That way it could have an option to use and allocate fixed disk storage if needed or required. Kind of Like a reverse MS-DOS ramdisk if you are old enough to remember using this within MS-DOS 5 I think it was.
Updated by Jonathan Lee over 1 year ago
is the Path Strip Count 2 for the patch?
Updated by Jonathan Lee over 1 year ago
I added your patch set this to 512mb and I am still getting that snort error for active rules
Crash report begins. Anonymous machine information:
arm64
14.0-CURRENT
FreeBSD 14.0-CURRENT #1 plus-RELENG_23_05_1-n256108-459fc493a87: Wed Jun 28 04:25:15 UTC 2023 root@freebsd:/var/jenkins/workspace/pfSense-Plus-snapshots-23_05_1-main/obj/aarch64/0P4W6joa/var/jenkins/workspace/pfSense-Plus-snapshots-23_05_1-main/source
Crash report details:
PHP Errors:
[04-Aug-2023 09:30:42 US/Pacific] PHP Fatal error: str_ireplace(): Cannot use output buffering in output buffering display handlers in /usr/local/www/csrf/csrf-magic.php on line 161
No FreeBSD crash data found.
Updated by Christopher Cope over 1 year ago
Jonathan Lee wrote in #note-12:
I added your patch set this to 512mb and I am still getting that snort error for active rules
Crash report begins. Anonymous machine information:
arm64
14.0-CURRENT
FreeBSD 14.0-CURRENT #1 plus-RELENG_23_05_1-n256108-459fc493a87: Wed Jun 28 04:25:15 UTC 2023 root@freebsd:/var/jenkins/workspace/pfSense-Plus-snapshots-23_05_1-main/obj/aarch64/0P4W6joa/var/jenkins/workspace/pfSense-Plus-snapshots-23_05_1-main/sourceCrash report details:
PHP Errors:
[04-Aug-2023 09:30:42 US/Pacific] PHP Fatal error: str_ireplace(): Cannot use output buffering in output buffering display handlers in /usr/local/www/csrf/csrf-magic.php on line 161No FreeBSD crash data found.
That error doesn't seem to be related to memory issues, so this patch wouldn't affect it.
Updated by Christopher Cope over 1 year ago
Jonathan Lee wrote in #note-10:
Could this also be adapted to use a disk swap? That way it could have an option to use and allocate fixed disk storage if needed or required. Kind of Like a reverse MS-DOS ramdisk if you are old enough to remember using this within MS-DOS 5 I think it was.
Right now, this just adds a GUI interface for the existing PHP memory limit settings. In almost all cases, the default values are sufficient.
I don't see there being much of a need to allocate disk space as well, but you could theoretically create a swap partition and increase this value to the point that it would start using that. That's definitely not tested nor recommended, though.
Updated by Jonathan Lee over 1 year ago
Thanks for the reply,
just to confirm the is the Path Strip Count 2 for your patch?
Updated by Christopher Cope over 1 year ago
Jonathan Lee wrote in #note-15:
Thanks for the reply,
just to confirm the is the Path Strip Count 2 for your patch?
That should be correct. Some updates are being made to the code still, so that's delaying the merge. That original patch is still functional, though.
Updated by Jim Pingle over 1 year ago
- Status changed from Pull Request Review to Feedback
- Target version changed from CE-Next to 2.8.0
MR Merged
Updated by Christopher Cope about 1 year ago
Tested on
23.09-DEVELOPMENT (amd64) built on Sat Aug 26 17:37:15 UTC 2023 FreeBSD 14.0-ALPHA2
It's merged in and functioning as expected. I'll wait for others to test as well, since I made the changes.
Updated by Chris W about 1 year ago
Systems with 1GB or less of RAM show a negative number as the hinted maximum adjusted value. The screenshot is taken from a virtual machine with 512 MB RAM (and with 1GB, the value becomes 128 to -62
).
Updated by Christopher Cope about 1 year ago
Chris W wrote in #note-19:
Systems with 1GB or less of RAM show a negative number as the hinted maximum adjusted value. The screenshot is taken from a virtual machine with 512 MB RAM (and with 1GB, the value becomes
128 to -62
).
Thanks for catching that. I have submitted a merge request to handle those cases more elegantly.
https://gitlab.netgate.com/pfSense/pfSense/-/merge_requests/1065
Updated by yon Liu about 1 year ago
Should allow the user to fill in the PHP memory according to the total memory capacity of the server
Updated by Jordan G about 1 year ago
still seeing a negative number suggested for the higher limit on system with <1gb RAM running 23.09-DEVELOPMENT-amd64-20230909-1856
Updated by Christopher Cope about 1 year ago
Jordan G wrote in #note-22:
still seeing a negative number suggested for the higher limit on system with <1gb RAM running 23.09-DEVELOPMENT-amd64-20230909-1856
The new patches weren't merged in yet, should be in the next build.
New patches just merged.
Updated by Jim Pingle about 1 year ago
- File clipboard-202309180840-vuqwy.png clipboard-202309180840-vuqwy.png added
- Status changed from Feedback to New
It's better but still quirky.
On a VM with 1GB RAM it says the default is 512 but the allowed range is 128 to 449, so there isn't a way to set the manual value as high as the default.
Updated by Jim Pingle about 1 year ago
- Status changed from New to In Progress
- Assignee changed from Christopher Cope to Jim Pingle
Updated by Jim Pingle about 1 year ago
- Status changed from In Progress to Feedback
Applied in changeset b5b4ab910a5dbae492dee19796f027bb2270eace.
Updated by Jordan G about 1 year ago
23.09 on 6100, this looks better for default and range
Updated by aleksei prokofiev about 1 year ago
- File clipboard-202311051030-9wftt.png clipboard-202311051030-9wftt.png added
- File clipboard-202311051036-vllrp.png clipboard-202311051036-vllrp.png added
- File clipboard-202311051046-vcslm.png clipboard-202311051046-vcslm.png added
Tested on
23.09-RC (amd64)
built on Fri Oct 27 1:51:00 UTC 2023
FreeBSD 14.0-CURRENT
Looks good, in VM it is calculated based on available RAM
Also, I can setup max available value
4g
2g
1g
Updated by Jim Pingle about 1 year ago
- Status changed from Feedback to Resolved
Updated by Jim Pingle about 1 year ago
- Target version changed from 2.8.0 to 2.7.1
Updated by Jonathan Lee 12 months ago
What is recommended for SG-2100MAX with 23.05.01 in use I can't remember I was using 128 I think but you guys are showing 512 now half a gb?