WordPress was telling me to update my PHP to 7.4 to be able to have the latest security and for the site to run optimally. So, I ran through the procedure to install PHP 7.4 on IIS and activate that version on the IIS server so that it would be used with my WordPress site.
When I changed the active PHP instance to 7.4 in IIS, my website broke completely and would not load any longer. I decided to revert back to 7.2 while I figured it out. From most of the troubleshooting instructions I saw said to check and disable the plugins. I had more than 20 plugins running which would take WAY too long to test each one.
I’m like, “There has to be a log with the errors like Event viewer for PHP since it is a PHP error!” After looking through the settings, I found the path to the error log file C:\Windows\Temp\PHP74x54_errors.log
Here is what I found in the log to lead me to the Crayon Syntax Highlighter to be the problem:
1 | 2021 04:04:24 UTC] PHP Warning: preg_replace(): Compilation failed: invalid range in character class at offset 4 in C:\inetpub\YourWebsite\wp-content\plugins\crayon-syntax-highlighter\crayon_langs.class.php on line 340 |
So I started looking on that error and found the following article:
Fix for Crayon Syntax Highlighter WordPress Plugin and PHP 7.3 Fatal Error • Crunchify
This article talks about Crayon not being updated for a long time and the changes in the PHP code for 7.3.1 and above breaking WordPress websites. I went through the article and repaired the PHP files that were broken and causing the error. There seemed to be four problems in the code. I did find the latest version on Github which had all the PHP files that needed changing. Instead of updating the entire plugin, I just updated the PHP files with the current version ones from the Github site. That worked great and my site is back up and running normally.
Thanks again the guys at Crunchify for fixing this issue. I’m sure we will have even more updates when WordPress finally catches up with PHP 8.0!
REFERENCES:
Crayon Syntax Highlighter Latest Version
Fix for Crayon Syntax Highlighter WordPress Plugin and PHP 7.3 Fatal Error • Crunchify
I’ve updated the Crayon Syntax Highlighter to work with PHP8 (as well as 7.4)
https://blog.icod.de/2021/11/29/crayon-syntax-highlighter-updated-for-php-8/