• I have been struggling with overloaded server memory issues. I have been reading up on wp-config and wp-settings regarding memory and wonder if I may have found a problem.

    In the wp-config tutorial, it says that the php memory settings will be listed near the top of the code. As you can see below, there are no settings, just a line prompting to set the memory limits.

    Is there a line missing?

    * @since 1.0.0
     */
    define( 'WPINC', 'wp-includes' );
    
    // Include files required for initialization.
    require( ABSPATH . WPINC . '/load.php' );
    require( ABSPATH . WPINC . '/default-constants.php' );
    
    /*
     * These can't be directly globalized in version.php. When updating,
     * we're including version.php from another install and don't want
     * these values to be overridden if already set.
     */
    global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version;
    require( ABSPATH . WPINC . '/version.php' );
    
    // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
    wp_initial_constants();
    
    // Check for the required PHP version and for the MySQL extension or a database drop-in.
    wp_check_php_mysql_versions();
    
    // Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php.
    @ini_set( 'magic_quotes_runtime', 0 );
    @ini_set( 'magic_quotes_sybase',  0 );

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]

Viewing 1 replies (of 1 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    The memory controls in wp-config.php were rendered obsolete quite a while ago. Where did you see this tutorial?

    Regarding the issue at hand, if you’re seeing this error either suddenly (no specific task was done to cause the error) or frequently, try deactivating all plugins to rule-out a plugin-specific issue and try switching themes to rule-out a theme-specific issue.

    Otherwise, here are three ways to increase PHP’s memory allocation:

    1. If you can edit or override the system php.ini file, increase the memory limit. For example, memory_limit = 256M

    2. If you cannot edit or override the system php.ini file, add php_value memory_limit 256M to your .htaccess file.

    3. If neither of these work, it’s time to ask your hosting provider to temporarily increase PHP’s memory allocation on your account. Keep in mind that most decent hosting providers allocate 32 MB to PHP under each account, and most decent hosting providers allow users to temporarily increase the memory allocation. If your hosting provider won’t accommodate you, perhaps it’s time to find a new hosting provider.

    (in the above examples, the limit is set to 256MB)

Viewing 1 replies (of 1 total)
  • The topic ‘wp-setting php memory problems’ is closed to new replies.