Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP recommendations always see memory limit as unlimited #2829

Closed
ddb4github opened this issue Jul 17, 2019 · 3 comments
Closed

PHP recommendations always see memory limit as unlimited #2829

ddb4github opened this issue Jul 17, 2019 · 3 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@ddb4github
Copy link
Contributor

Describe the bug
cli_check.php return incorrect memory_limit
Maybe, cli_check.php output is impacted by some ini_set usage

To Reproduce

# php -i | grep memory_limit
memory_limit => 800M => 800M
# ./cli_check.php recommends | sed -e 's/},/}\n/g'; echo
[{"name":"version","value":"5.4.0","current":"7.2.19-0ubuntu0.18.04.1","status":2}
{"name":"memory_limit","value":"400M","current":"-1M","status":2}
{"name":"max_execution_time","value":60,"current":"0","status":2}
{"name":"date.timezone","value":"<timezone>","current":"Asia\/Chongqing","status":2}]
@netniV
Copy link
Member

netniV commented Jul 17, 2019

Liking the use of sed there :D

The cli_check.php uses the built in PHP functions to get the details so if it reports 400M that is what is being returned by ini_get() within the function in install/functions.php.

I don’t believe we have a hard coded value as default though if we did, that would mean that we aren’t getting the memory limit back. Since I’ve tested that functionality recently, I know it picked up my memory limit.

What OS are you running on btw?

@netniV
Copy link
Member

netniV commented Jul 17, 2019

Wait, 400M is the minimum. I see the real issue is that the value is always -1 even if it had a value.

@netniV netniV changed the title cli_check.php return incorrect memory_limit PHP recommendations always see memory limit as unlimited Jul 17, 2019
@netniV
Copy link
Member

netniV commented Jul 17, 2019

This seems to have been introduced by #2712 (Memory limit should be unlimited) as the variable $original_memory_limit was removed which is used by the utility if present. The cli_check.php routine did set that before setting the memory to 500M before but as part of the conversion it was accidentally removed.

I don't think it's a big impact on upgrade since most systems will already have the right value, but new installs may not.

Try this patch:

diff --git a/install/cli_check.php b/install/cli_check.php
index 7cf74f76..f8890806 100644
--- a/install/cli_check.php
+++ b/install/cli_check.php
@@ -23,6 +23,9 @@
  +-------------------------------------------------------------------------+
 */
 
+global $original_memory_limit;
+
+$original_memory_limit = ini_get('memory_limit');
 ini_set('memory_limit','-1');
 
 include(dirname(__FILE__) . '/../include/cli_check.php');

@netniV netniV closed this as completed in 3f9586f Jul 17, 2019
@netniV netniV added bug Undesired behaviour resolved A fixed issue labels Jul 17, 2019
@netniV netniV added this to the v1.2.6 milestone Jul 17, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

2 participants