[wp-trac] [WordPress Trac] #49329: memory_limit in site health is not really correct, value is taken from wp_raise_memory_limit

WordPress Trac noreply at wordpress.org
Fri Jun 26 09:46:23 UTC 2020


#49329: memory_limit in site health is not really correct, value is taken from
wp_raise_memory_limit
-------------------------------------------------+-------------------------
 Reporter:  espiat                               |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  5.5
Component:  Site Health                          |     Version:  5.3.2
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing 2nd-opinion needs-     |     Focuses:
  patch                                          |  administration
-------------------------------------------------+-------------------------

Comment (by zodiac1978):

 Replying to [comment:34 Clorith]:

 > A host which does not have the memory to allocate could disable the
 function that lets PHP, and thus also WP, from changing the available
 memory limit.

 I have not seen any hoster doing this. As I wrote above, you can set a
 higher limit than the actual available limit on the host for all hosters I
 know. Therefore the values are not reliable if not got very early in the
 chain or through the correct function.

 > I may need someone to summarize what the remaining issue in this ticket
 is, as I fear I'm not quite grasping it at this time.

 In the latest alpha (5.5-alpha-48171) the values for me are:

 {{{
 PHP-Speicher-Limit (memory_limit)       100M
 PHP memory limit (only for admin screens)       256M
 }}}

 Although I have 128M as the "real" limit (on this shared hoster). That is
 the **actual bug** at the moment.

 256M are not available. WP is just ''trying'' to get this value. So this
 value is not helpful for my debugging IMHO.

 100M is not the correct limit too. (No plugin activated, Twenty Twenty
 theme, no .htaccess or php.ini/.user.ini with different settings involved)

 `$ini_all[ 'memory_limit' ][ 'global_value' ]` seems to be the better
 approach here IMHO.

 We could use it if it is available and fallback to `ini_get` if not. Or we
 do it the hard way:

 > For example, doing a loopback request in which you add a shutdown
 handler for reporting and then fill up memory (while disabling error
 reporting!).

 This was a suggestion from @schlessera on Twitter.

 I think reporting the local value is not useful at all and should be
 removed again, because it is not reliable that the value of memory is
 really available. It is more like a "max-width" value for the memory which
 is not helpful is most cases.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49329#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list