• Resolved ronicke

    (@ronicke)


    Hi Everyone.

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in C:\wamp64\www\techsolutions\wp-includes\cache.php on line 123

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

    Wampserver version: 3.2.0

    I installed the wordpress (version: 5.3.2) package on my localhost wampserver.
    After the I finished the wordpress installation process, I decided to create my own theme from scrath.

    So I started creating the folder inside “wp-content/themes/” with my project name ->
    “wp-content/themes/techsolutions/”
    After that I created the style.css where I added the theme name, Author and version.
    Then I created the .php files (index, header, footer, single, page, archive, front-page and functions).

    I also added a css folder and a js folder. Inside these folders I added the newest bootstrap and Jquery packages.

    The issue started when I inside the function.php file tried to enqueue the css and js files with the following code.

    function load_stylesheets()
    {
    wp_register_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.css', array(), '4.4.1', 'all' );
    wp_enqueue_style('bootstrap');
    
    wp_register_style('style', get_template_directory_uri() . '/style.css', array(), '4.4', 'all' );
     wp_enqueue_style('style');
    }
    
    add_action('wp_enqueue_style', 'load_stylesheets');
    function load_jquery()
    {
    wp_register_script('jquery', get_template_directory_uri() . '/js/jquery.3.4.1.js', '', '3.4.1', true);
    wp_enqueue_scripts('jquery');
    }
    add_action('wp_enqueue_scripts', 'load_jquery');
    function load_scripts()
    {
     wp_register_script('customScripts', get_template_directory_uri() . '/js/scripts.js', '', '1.0.0', true);
     wp_enqueue_scripts('customScripts');
    }
    
    add_action('wp_enqueue_scripts', 'load_scripts');

    I noticed that the error started when I added the script/jquery functions.

    But I can’t figure out why..

    I’ve tried to add more memory to php.ini, wp-config.php and htaccess…

    I hope someone can help me.

    • This topic was modified 4 years, 9 months ago by ronicke.
    • This topic was modified 4 years, 9 months ago by ronicke.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Well, it looks like may the problem is that you are de-registering the core-bundled version of jQuery, and re-registering another JQuery version.

    Thread Starter ronicke

    (@ronicke)

    Thank you for helping me on the right path.
    I was not aware that WordPress already included the jquery package.

    function load_stylesheets()
    {
        /*
         * array() if its required to load another script too before working. Version. media
         */
        wp_register_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.css', array(), '4.4.1', 'all' );
        wp_enqueue_style('bootstrap');
        /*
         * For override purpose - Load this last.
         */
        wp_register_style('style', get_template_directory_uri() . '/style.css', array(), '4.4', 'all' );
        wp_enqueue_style('style');
    }
    
    /*
     *  Add the function to be run.
     */
    add_action('wp_enqueue_style', 'load_stylesheets');
    
    function load_scripts(){
        wp_register_script('customScript', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ), '1.0.0', true);
        wp_enqueue_script( 'customScript' );
    }
    add_action('wp_enqueue_scripts', 'load_scripts');
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WAMP – WordPress -exhausted memory limit’ is closed to new replies.