# Turning on debug mode and reading the error log

> Turn on WordPress debug mode from the Phluit portal to record PHP errors and warnings, read the last 300 lines of the error log, and clear it.

Source: https://docs.phluit.com/products/managed-wordpress/wordpress-debug-mode-and-error-log/

When a plugin or theme misbehaves, the error log usually tells you why. Switch on **debug mode** to record PHP errors and warnings, reproduce the problem, then read the log in the portal.

## Step 1: Turn on debug mode

1.  In the portal (**portal.phluit.com**), go to **My Sites** and open the site.
2.  Click the **Advanced** tab, then **Developer settings**.
3.  Switch on **Debug mode** and confirm _"Turn debug mode on? The site restarts (a few seconds)."_

From now on, PHP errors and warnings from WordPress, plugins and themes are written to the error log (`wp-content/debug.log`).

Only if you need it, tick **Also show errors on the pages (visible to visitors)**. Errors then appear on the pages themselves. Don't leave this on for a live site: visitors see them too.

## Step 2: Reproduce the problem

Open the page or do the action that goes wrong, so the error is recorded.

## Step 3: Read the log

1.  Go to **Advanced → Logs**.
2.  Click **Load** (or **Refresh** to read it again).

You see the last 300 lines of the error log, with the time it was read and the log's size. Look for lines with **PHP Fatal error** or **PHP Warning**: the file path in them usually names the plugin or theme that causes the problem, for example `wp-content/plugins/plugin-name/…`.

To start again with an empty log, click **Clear** and confirm _"Empty the error log?"_

## Step 4: Turn debug mode off

When you're done, go back to **Advanced → Developer settings** and switch **Debug mode** off. The site restarts for a few seconds. The log keeps what was recorded until you clear it.

## What to do with what you find

-   **A plugin is named in the error:** deactivate it on the **Plugins** tab and check whether the problem is gone, then contact the plugin's developer. See [Managing plugins from My Sites](/products/managed-wordpress/wordpress-manage-plugins/).
-   **It started after an update:** restore the backup from before the update. See [Restoring a backup (and undoing a restore)](/products/managed-wordpress/wordpress-restore-backup/).
-   **"Allowed memory size exhausted":** raise the memory limit under **PHP & e-mail**. See [PHP settings: memory, uploads, execution time and input variables](/products/managed-wordpress/wordpress-php-settings/).
-   **You're stuck:** open a support ticket and paste the relevant lines from the log.

## Good to know

-   When debug mode is off, the log says _"Turn on debug mode under Developer settings to record them."_
-   Turning debug mode on or off restarts the site, which takes a few seconds.
-   Every change appears on the **Activity** tab.
