Skip to content

[2.x] fix: Detect the web memory limit from Debian/Ubuntu's FPM conf.d - #4991

Merged
imorland merged 1 commit into
2.xfrom
im/info-web-memory-confd
Aug 26, 2026
Merged

imorland merged 1 commit into
2.xfrom
im/info-web-memory-confd

Conversation

@imorland

Copy link
Copy Markdown
Member

Changes proposed in this pull request:

flarum info reports the web SAPI's memory_limit by scanning a fixed list of config files and one hard-coded conf.d directory (/usr/local/etc/php/conf.d, the Docker layout). On Debian and Ubuntu the effective value is usually set in /etc/php/{version}/fpm/conf.d/ — which nothing in the list covered — so the detection fell through to the base php.ini value and reported a figure well below the real one (a report in the wild: "Web: 128M" shown against a real 512M).

That output is exactly what people paste into support threads, so a wrong figure actively misleads diagnosis.

  • The conf.d scan now covers the Debian/Ubuntu FPM directories (/etc/php/{version}/fpm/conf.d and the /etc/php{version}/... variant) alongside the Docker one.
  • Within a conf.d directory the last matching file wins, mirroring how PHP loads conf.d in name order (a later 99-*.ini overrides an earlier 10-*.ini), rather than returning the first match found.
  • The file list and the conf.d list are now their own protected methods, so the detection can be tested against fixture directories instead of the real system paths.

This is a display-only diagnostic; it changes nothing about how Flarum runs.

Reviewers should focus on:

  • That the default conf.d list includes the Debian/Ubuntu FPM path — there's a test pinning exactly that, since it's the bug.
  • That "last match wins" within a directory is the right ordering for conf.d.

Necessity

  • Has the problem that is being solved here been clearly explained? — flarum info misreports the web memory limit on the most common distro layout.
  • If applicable, have various options for solving this problem been considered? — scanning the distro conf.d is the direct fix; parsing php-fpm -i output would be heavier and not always available.
  • For core PRs, does this need to be in core, or could it be in an extension? — flarum info is a core command.
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation. — no frontend changes.
  • Frontend changes: tests are green — n/a.
  • Frontend changes: tests have been added — n/a.
  • Backend changes: tests are green (run composer test).
  • Backend changes: tests have been added, or are not appropriate here. — tests cover reading a limit from a conf.d override, later-file precedence, direct-file precedence over conf.d, the empty case, and that the default list covers the Debian/Ubuntu FPM path.
  • Where applicable, changes are suitable for all supported database drivers (MySQL, MariaDB, PostgreSQL, SQLite). — no database involvement.
  • The description above is written by me and describes what this pull request actually does.

Required changes:

  • Related documentation PR: (Remove if irrelevant)

flarum info reports the web SAPI's memory_limit by scanning a fixed list
of config files. On Debian and Ubuntu the real value is usually set in
/etc/php/{version}/fpm/conf.d/, which the list never covered, so it fell
back to the base php.ini value and reported a limit far below the real
one. That output is what people paste into support threads, so a wrong
figure sends diagnosis down the wrong path.

Scan the fpm conf.d directories too, keeping the last match in name order
to mirror how PHP loads them. The file and directory lists are now their
own methods so the detection can be tested against fixtures.
@imorland
imorland requested a review from a team as a code owner August 26, 2026 14:46
@imorland imorland changed the title Detect the web memory limit from Debian/Ubuntu's FPM conf.d [2.x] fix: Detect the web memory limit from Debian/Ubuntu's FPM conf.d Aug 26, 2026
@imorland imorland added this to the 2.0.0-rc.8 milestone Aug 26, 2026
@imorland
imorland merged commit aa84e71 into 2.x Aug 26, 2026
29 checks passed
@imorland
imorland deleted the im/info-web-memory-confd branch August 26, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant