Guguweb - wordpresshttps://www.guguweb.com/2022-01-14T21:13:51+01:00Freelance developer and sysadminThe site is experiencing technical difficulties in WordPress. Now what?2019-09-26T12:19:58+00:002022-01-14T21:13:51+01:00Augusto Destrerotag:www.guguweb.com,2019-09-26:/2019/09/26/the-site-is-experiencing-technical-difficulties-in-wordpress-now-what/<p>Since <a href="https://wordpress.org/news/2019/05/jaco/">WordPress version 5.2</a> – in the case of fatal errors in your code – the scary WSOD (white screen of death) was substituted with a more elegant page with an error message “The site is experiencing technical difficulties”.</p>
<p>This kind of errors usually depend on some plugin which is incompatible …</p><p>Since <a href="https://wordpress.org/news/2019/05/jaco/">WordPress version 5.2</a> – in the case of fatal errors in your code – the scary WSOD (white screen of death) was substituted with a more elegant page with an error message “The site is experiencing technical difficulties”.</p>
<p>This kind of errors usually depend on some plugin which is incompatible with another one or a missing dependency on your server. It can also be related to your memory_limit setting in php.ini, where the default value of 128M is not sufficient for your website.</p>
<p>If you experience this error and you google for it, you can find many tutorials on how to fix the error. It basically involves adding these lines to your <code>wp-config.php</code>:</p>
<div class="highlight"><pre><span></span><code><span class="cp"><?php</span>
<span class="nb">define</span><span class="p">(</span><span class="s1">'WP_DEBUG'</span><span class="p">,</span> <span class="k">true</span><span class="p">);</span>
<span class="nb">define</span><span class="p">(</span><span class="s1">'WP_DEBUG_LOG'</span><span class="p">,</span> <span class="k">true</span><span class="p">);</span>
<span class="nb">define</span><span class="p">(</span><span class="s1">'WP_DEBUG_DISPLAY'</span><span class="p">,</span> <span class="k">false</span> <span class="p">);</span>
<span class="cp">?></span><span class="x"></span>
</code></pre></div>
<p>And then looking for PHP errors in the <code>wp-content/debug.log</code> file.</p>
<p>In my case I had an error, I saw the message, but nothing showed up in the debug log. Also I had nothing in Apache logs.</p>
<p>I digged into the WordPress code and saw that the message “The site is experiencing technical difficulties” is shown in the <code>wp-includes/class-wp-fatal-error-handler.php.</code></p>
<p>There I found an interesting part of code that lets you customize how the error will be shown to the user. You should create a file named <code>php-error.php</code> inside the <code>wp-content</code> directory. In my case the file content is very simple:</p>
<div class="highlight"><pre><span></span><code><span class="cp"><?php</span>
<span class="nb">print_r</span><span class="p">(</span><span class="nv">$error</span><span class="p">);</span>
<span class="cp">?></span><span class="x"></span>
</code></pre></div>
<p>In this way I could see what the actual error was and I was able to solve it!</p>
<p>Do you need help with your WordPress site? Please have a look at my <a href="https://www.guguweb.com/service/wordpress/">WordPress services</a>.</p>