Support » Fixing WordPress » WordPress 4.7 Fatal Error Cannot redeclare get_paged_template()

  • Resolved AcidRaZor

    (@acidrazor)


    Trying to upgrade, just as it finished and goes to about.php?updated it gave an HTTP 500 error

    PHP message: PHP Fatal error: Cannot redeclare get_paged_template() (previously declared in /home/public_html/wp-includes/template.php:360) in /home/public_html/wp-includes/deprecated.php on line 3774

    Server is running NGINX and PHP 7.0
    Cache is cleared (I’m not running any caching plugins)
    I restarted the server to make sure.
    I tried removing all templates/plugins and keeping just the latest as recommended
    I tried a manual upgrade and followed the instructions, same error occurs

    This is just a bit too much. A live site with thousands of visitors is sitting broken now. Brilliant.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator πŸš€

    That appears to be related to https://core.trac.wordpress.org/ticket/38162 and would therefore be a problem with your theme using a very old and deprecated function.

    For now, access your server via SFTP or FTP, or a file manager in your hosting account’s control panel, navigate to /wp-content/themes/ and rename the directory of your currently active theme. This will force the default theme to activate so you can use your site.

    Then, I recommend getting in touch with the theme’s developer.

    Pascal Birchler

    (@swissspidy)

    Howdy,

    Thanks for your report!

    In WordPress 4.7, get_paged_template() was moved to wp-includes/deprecated.php. The fatal error could be caused by PHP’s internal OpCache or an incomplete update.

    Since you’ve already tried a manual upgrade, OpCache is more likely. It’s an internal cache, not a caching plugin or something external. To flush the OpCache, you could do this:

    1. Create a new file, flush_opcache.php, in the same directory as wp-config.php and wp-content.
    2. Open http://yoursite.com/flush_opcache.php in your browser
    3. Delete the file again
    4. Visit your dashboard to see if the error still occurs

    Let me know if that works or if you do not have (S)FTP access and need to find another way to test this.

    Cheers.

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator πŸš€

    Nice OpCache flush trick @swissspidy, thanks!

    Pascal Birchler

    (@swissspidy)

    Oops, I forgot the most important part! Put the following in your flush_opcache.php file:

    <?php opcache_reset(); ?>

    AcidRaZor

    (@acidrazor)

    @macmanx As I mentioned, I followed the steps, removed all Themes and only left twentyseventeen. Unless twentyseventeen has a bug in it causing this?

    @swissspidy Thank you for your reply, however, won’t rebooting the server clear OpCache?

    I’ve downgraded to 4.6.1 and things are working again

    AcidRaZor

    (@acidrazor)

    @swissspidy I upgraded again, same error, then used the opcache reset trick and it worked

    Thank both of you guys for helping out on this

    Pascal Birchler

    (@swissspidy)

    @acidrazor Awesome! Great to hear that worked. I’ll note that on the Trac ticket referenced above.

    Regarding your question:

    > won’t rebooting the server clear OpCache?

    This depends on the server setup and what exactly has been restarted, the whole computer, the Apache/nginx web server or the php-fpm service (if applicable). The opcache_reset() variant helps under all circumstances.

    AcidRaZor

    (@acidrazor)

    I found the Opcache is an on-going issue, so saw this blog post explaining on how to add a must-use plugin that will clear it before you upgrade: https://www.saotn.org/wordpress-plugin-flush-php-opcache/

    Awesome, this worked for me (opcache). Thanks for saving me hours of troubleshooting!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘WordPress 4.7 Fatal Error Cannot redeclare get_paged_template()’ is closed to new replies.