Sunday, May 5, 2024

Wordpress Error - There has been a critical error on this website.

 Two of my sites went down with the following message:

"There has been a critical error on this website"

No other information was given on the page.  Typically this has been an issue with a plug-in and I've just gone into the /wp-content/plugins directory and renamed the plug-ins one at a time to see which one was miss-behaving.  That didn't work this time, nor did moving the current themes directory and only leaving one "default" theme in place.  

What I did find in the logs was this error:

Got error 'PHP message: PHP Fatal error:  Array and string offset access syntax with curly braces is no longer supported


It is my understanding that this is a php compatibility issue going from 7.4 to 8.1.  I don't recall this happening at the time of install and maybe I was running two versions of PHP at that time.


In order to resolve this error I took the following steps and it was successful for my install, which was 6.4. Your results may vary.


From a working 6.5.2 install, I copied a file and one directory to my site.

  • Copied the index.php file from /var/www/website/wp-includes/blocks/index.php
    • This got the site to come back up, but I could not access the /wp-admin login page.
  • Renamed the wp-admin folder and copied the wp-admin folder from the 6.5.2 version.
    • This gave me access to my Admin Console and I then initiated a WordPress upgrade.  On one site I had to do a "reinstall 6.5.2" and on the other it just prompted to do an upgrade.  Both sites are now up and fully functional.