• Resolved websavers

    (@websavers)


    Odd one for ya. Running code profiler on a site homepage. It comes back with a 500 error. Server logs show:

    AH01071: Got error 'PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 10000312 bytes) in path_to_wordpress/wp-content/plugins/code-profiler/lib/class-profiler.php on line 177'

    Normally we’d just increase the memory_limit value in the PHP config for the domain in Plesk. The problem is the memory limit is already 1G even though the error is indicating it’s 256MB. Even the server-wide php.ini for this version of PHP is 512MB and not 256MB.

    The Support tab in Code Profiler even confirms this, as does phpinfo().

    [sysinfo] => Array
        (
            [OS] => SNIPPED
            [HTTP server] => Apache
            [PHP] => FPM-FCGI 8.1.27
            [Opcode cache] => Zend OPcache (enabled)
            [Memory limit] => 1G

    Have you ever encountered a case like this where the server log was showing the memory limit not matching the actual value?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter websavers

    (@websavers)

    Turns out this was Divi Builder. No idea why it forces a 256M limit like that. In case anyone needed more proof Divi is garbage…

    Plugin Author nintechnet

    (@nintechnet)

    Maybe that was the memory limit that is set by WordPress ?
    The profiler tries to disable any limit but if it failed (server restriction etc), you’re facing the limit sets by WP.

    • This reply was modified 10 months ago by nintechnet.
    Thread Starter websavers

    (@websavers)

    I’m quite certain the issue stems from this Divi file: core/components/Portability.php with this function:

            protected function prevent_failure() {
                    @set_time_limit( 0 );
    
                    // Increase memory which is safe at this stage of the request.
                    if ( et_core_get_memory_limit() < 256 ) {
                            @ini_set( 'memory_limit', '256M' );
                    }
            }

    I’m betting that 1) this is hooked in late and so other parts of WP don’t see it because the limit hasn’t been set yet, and 2) it’s failing to get the current limit properly.

    If you ask me Divi should absolutely not be doing this. If they’re encountering memory limit issues they should warn the user that the limit is too low, not try to force a new limit… that itself is too low. I find this typical for Divi programming though: trying to be too user friendly and shooting itself in the foot.

    Also, I know it’s Divi because deactivating the Divi Builder plugin completely resolved the issue. Also made the entire WP admin and loading uncached pages way faster.

    • This reply was modified 10 months ago by websavers.
    • This reply was modified 10 months ago by websavers.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘500 error due to PHP memory_limit… but limit is higher’ is closed to new replies.