Optimize PHP INI defaults for embedded environment#1
Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Open
Optimize PHP INI defaults for embedded environment#1devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
- Replace deprecated iconv.internal_encoding with default_charset (deprecated since PHP 5.6) - Change memory_limit from 3072M to -1 (unlimited, appropriate for embed SAPI) Co-Authored-By: Maxime Larrivée-Roy <maxime@diametrick.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two changes to the
embeded_ini_defaultsfunction inembeder.cpp:Replace deprecated
iconv.internal_encodingwithdefault_charseticonv.internal_encodinghas been deprecated since PHP 5.6 and triggers deprecation notices on PHP 8.x. The modern replacement isdefault_charset, which serves as the encoding default for iconv, mbstring, htmlspecialchars, and htmlentities. Value remainsUTF-8.Change
memory_limitfrom3072Mto-1(unlimited)For an embedded SAPI there is no multi-tenant server environment where a per-request memory limit protects against resource exhaustion.
-1lets the OS enforce actual memory limits instead of an arbitrary 3GB ceiling.The
memory_limitandzlib.output_compressionentries were reordered as a side effect; no other settings were modified.Review & Testing Checklist for Human
memory_limit = -1is acceptable for your use case. If the embedded PHP environment ever runs untrusted or poorly-written scripts, removing the memory ceiling means a runaway script could consume all system memory until the OS kills the process. If a safety net is desired, consider a higher-but-finite value instead.iconv.internal_encodingtodefault_charsetis desired.default_charsethas a wider scope—it also affectshtmlspecialchars,htmlentities, and mbstring, not just iconv. In practice PHP 8.x already defaultsdefault_charsetto UTF-8, so the net effect should be zero, but verify no downstream code relies ondefault_charsetbeing unset by the embedder.Notes
zlib.output_compression = 0was kept even though it is redundant (already the PHP default and irrelevant for embed SAPI which doesn't serve HTTP). Removing it is optional cleanup.com.allow_dcom = 1was reviewed but left as-is; note that it enables remote/distributed COM object instantiation, which has security implications if not needed.phar.readonly = 0was reviewed but left as-is; PHP docs recommend keeping it enabled on production machines.Link to Devin session: https://app.devin.ai/sessions/5cc20d5ba3324bb3ba32c56d76986af7
Requested by: @ZmotriN