{"id":1410,"date":"2021-06-16T09:02:53","date_gmt":"2021-06-16T14:02:53","guid":{"rendered":"https:\/\/itblog.ldlnet.net\/?p=1410"},"modified":"2021-06-16T09:07:20","modified_gmt":"2021-06-16T14:07:20","slug":"crayon-syntax-highlighter-plugin-for-wordpress-breaks-website","status":"publish","type":"post","link":"https:\/\/itblog.ldlnet.net\/index.php\/2021\/06\/16\/crayon-syntax-highlighter-plugin-for-wordpress-breaks-website\/","title":{"rendered":"Crayon Syntax Highlighter Plugin for WordPress breaks website."},"content":{"rendered":"\n<p>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.<\/p>\n\n\n\n<p>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. <\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">I&#8217;m like, &#8220;There has to be a log with the errors like Event viewer for PHP since it is a PHP error!&#8221; After looking through the settings, I found the path to the error log file<strong> <em>C:\\Windows\\Temp\\PHP74x54_errors.log<\/em><\/strong><\/p>\n\n\n\n<p>Here is what I found in the log to lead me to the Crayon Syntax Highlighter to be the problem:<\/p>\n\n\n<pre class=\"lang:PowerShell nums:False\">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<\/pre>\n\n\n\n<p>So I started looking on that error and found the following article:<\/p>\n\n\n\n<p><a href=\"https:\/\/crunchify.com\/fix-for-crayon-syntax-highlighter-wordpress-plugin-and-php-7-3-fatal-error\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Fix for Crayon Syntax Highlighter WordPress Plugin and PHP 7.3 Fatal Error \u2022 Crunchify<\/strong><\/a><\/p>\n\n\n\n<p>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 <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/Crunchify\/crayon-syntax-highlighter\/releases\" target=\"_blank\">Github<\/a> 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.<\/p>\n\n\n\n<h4 class=\"has-text-align-center wp-block-heading\">Thanks again the guys at Crunchify for fixing this issue. I&#8217;m sure we will have even more updates when WordPress finally catches up with PHP 8.0!<\/h4>\n\n\n\n<p class=\"has-small-font-size\"><strong><em>REFERENCES:<\/em><\/strong><br><a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/Crunchify\/crayon-syntax-highlighter\/releases\" target=\"_blank\"><strong>Crayon Syntax Highlighter Latest Version<\/strong><\/a><br><a href=\"https:\/\/crunchify.com\/fix-for-crayon-syntax-highlighter-wordpress-plugin-and-php-7-3-fatal-error\/\"><strong>Fix for Crayon Syntax Highlighter WordPress Plugin and PHP 7.3 Fatal Error \u2022 Crunchify<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress was telling me to update my PHP to 7.4 to be able to have the latest security and for the site<\/p>\n<p class=\"link-more\"><a class=\"myButt \" href=\"https:\/\/itblog.ldlnet.net\/index.php\/2021\/06\/16\/crayon-syntax-highlighter-plugin-for-wordpress-breaks-website\/\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":1411,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,1,16],"tags":[294,170,290,291,292,293],"class_list":["post-1410","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general","category-uncategorized","category-windows","tag-crayon-syntax-highlighter","tag-iis","tag-php","tag-php-7-4","tag-wordpress","tag-wordpress-update","odd"],"_links":{"self":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/1410","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/comments?post=1410"}],"version-history":[{"count":4,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/1410\/revisions"}],"predecessor-version":[{"id":196123,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/1410\/revisions\/196123"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/media\/1411"}],"wp:attachment":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/media?parent=1410"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/categories?post=1410"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/tags?post=1410"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}