WordPress.org

Ready to get started?Download WordPress

Forums

cache.php error line 48 (9 posts)

  1. chanz
    Member
    Posted 7 years ago #

    I'm unable to select the number of recent posts to show on my main page. There is a cache error on the Options/reading page. It states:

    /wp-includes/cache.php on line 48

    How do I resolve this?
    Thank you.

  2. drmiketemp
    Member
    Posted 7 years ago #

    what version of wordpress are you running?

    Whats the specifc error?

    Have you checked your error logs yet?

  3. chanz
    Member
    Posted 7 years ago #

    Version WordPress 2.2.1

    Specific error:
    Fatal error: Allowed memory size of 10485760 bytes exhausted (tried to allocate 4734 bytes) in
    .../wp-includes/cache.php on line 48

    Error logs?
    How do I access this?

  4. whooami
    Member
    Posted 7 years ago #

  5. chanz
    Member
    Posted 7 years ago #

    Thank you, whoami.
    I will contact my hosting service (grr... as they are incredibly inutile).
    Wish there was something I could do from my end.

  6. chanz
    Member
    Posted 7 years ago #

    Update... my hosting service will not help.

    Anything I can do?

  7. drmiketemp
    Member
    Posted 7 years ago #

    Turn off plugins or move hosts. I'd lean towards number 2 as your current host just told you that they didn't want to help you. I like http://synhosting.com myself.

  8. Mrasnika
    Member
    Posted 6 years ago #

    Hey, I got a solution that worked for me. In order to do that you have to modify a couple of files.

    First, open your config file (wp-config.php), and a line like this;

    define ('DISABLE_CACHE', '1');

    It has to be before the require_once call!

    Generally, this would turn the cache off. However, there are two small bugs that prevent this feature for working. In order to fix them, open your wp-includes/cache.php file. Find the wp_cache_replace and the wp_cache_set functions. Those are the ones that cause the trouble, and that's because of the serialize|unserialize calls. We have disabled the caching, but nevertheless those functions are not aware of it, because the serialize|unserialize calls are executed before it. So, here's the patch: add the following line:

    function wp_cache_set($key, $data, $flag = '', $expire = 0) {
    
    	if (defined('DISABLE_CACHE'))
    		return;
    
    	if ( ! defined('ENABLE_CACHE') )
    		return;
    
    	global $wp_object_cache;
    
    	$data = unserialize(serialize($data));
    
    	return $wp_object_cache->set($key, $data, $flag, $expire);
    }

    That's it. Remember to do this to both functions wp_cache_replace and the wp_cache_set

  9. joneshatyai
    Member
    Posted 6 years ago #

    Solved!!
    Thanks Mrasnika

Topic Closed

This topic has been closed to new replies.

About this Topic