0

I am receiving a "cannot allocate memory" error on Wordpress and none of the other threads helped me so I decided to ask again being specific with mine.

I run a dedicated server with the following specs below:

Godaddy Dedicated Server

On the server I run an Wordpress adult site that allows users to stream videos hosted on the server. -----> NSFW My Website

For some reason I keep getting this error below:

(12)Cannot allocate memory: couldn't create child process: /usr/sbin/suphp

I only get this error when I "Publish" multiple(10-100) videos to the website at once.

Below is the code in my php.ini

upload_max_filesize = 3000M
post_max_size = 2000M
memory_limit = 5000M
file_uploads = On
max_execution_time = 300

This is what it looks like from the Server Manager on GoDaddy when I am not clicking "Publish"

enter image description here

Also here are more of the error after doing a recent mass publish and this will continue for about 2-3 minutes before it will stop completely

[Wed Nov 08 17:57:16.840005 2017] [:error] (12)Cannot allocate memory: [client] couldn't create child process: /usr/sbin/suphp for
[Wed Nov 08 17:57:16.839550 2017] [:error] (12)Cannot allocate memory: [client] couldn't create child process: /usr/sbin/suphp for
[Wed Nov 08 17:57:16.836552 2017] [:error] (12)Cannot allocate memory: [client] couldn't create child process: /usr/sbin/suphp for
[Wed Nov 08 17:57:16.836021 2017] [:error] (12)Cannot allocate memory: [client] couldn't create child process: /usr/sbin/suphp for
[Wed Nov 08 17:57:16.832745 2017] [:error] (12)Cannot allocate memory: [client] couldn't create child process: /usr/sbin/suphp for
[Wed Nov 08 17:57:16.832256 2017] [:error] (12)Cannot allocate memory: [client] couldn't create child process: /usr/sbin/suphp for
[Wed Nov 08 17:57:02.669004 2017] [:error] (12)Cannot allocate memory: [client] couldn't create child process: /usr/sbin/suphp for
[Wed Nov 08 17:57:02.668845 2017] [:error] (12)Cannot allocate memory: [client] couldn't create child process: /usr/sbin/suphp for

I am not using CloudLinux and RLimitMEM is not enabled

Here is my /wp-includes/default-constants.php

// Define memory limits.
    if ( ! defined( 'WP_MEMORY_LIMIT' ) ) {
        if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
            define( 'WP_MEMORY_LIMIT', $current_limit );
        } elseif ( is_multisite() ) {
            define( 'WP_MEMORY_LIMIT', '512M' );
        } else {
            define( 'WP_MEMORY_LIMIT', '512M' );
        }
    }

    if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
        if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
            define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
        } elseif ( -1 === $current_limit_int || $current_limit_int > 268435456 /* = 512M */ ) {
            define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
        } else {
            define( 'WP_MAX_MEMORY_LIMIT', '512M' );
        }
    }
TevinTwoTimes
  • 103
  • 1
  • 10
  • 1) have you tried to remove memory_limit by setting it's value to -1?, 2) are you implementing concurrency? – Mark Nov 09 '17 at 01:52
  • Hmmm I will try that setting to -1. I do that in the php.ini file correct? I've never heard of the concurrency thing. Will look that up also. I won't be able to test until my next upload though. Then I can come back and reply the solution. Thank you for those tips – TevinTwoTimes Nov 09 '17 at 01:58
  • Yes. You set it in your php.ini, setting it will remove memory limit but you should be aware of consequences such as possible memory leaks. About concurrency, If you are implementing it you should limit your max workers. If you have a total of 4 cores limit it to 3, 1 is for the main process and 3 is for the sub-process. I prefer multi-threading instead of multi-processing. – Mark Nov 09 '17 at 02:04
  • Great! I will look at that when I test again later tonight – TevinTwoTimes Nov 09 '17 at 02:05
  • BTW, I can't help you in multi-processing nor multi-threading in PHP because I don't know how to do it in PHP I'm just doing it in other languages such as C++ and Python. Just to give you idea how to manage your processes. – Mark Nov 09 '17 at 02:09

1 Answers1

-1
  • the issue is resolved by increasing php.ini memory limit in apache configuration file
  • Make sure the memory_limit value in /usr/local/lib/php.ini is set to a higher value
  • Raise the wordpress memory limit defined in /wp-includes/default-constants.php