# Finding PHP error logs and showing or hiding errors

> Where to find PHP error logs on Ruachost hosting, and how to show errors while you fix a problem and hide them again on a live site.

Source: https://helpcenter.ruachost.com/developers/php/enabling-php-error-logging/

When a PHP site shows a blank page, a **500 error** or "There has been a critical error on this website", the PHP error log usually tells you why.

## Where to find PHP error logs

PHP error logging is **on** by default. PHP writes errors to a file called **`error_log`** in the same folder as the script that failed, for example:

- `public_html/error_log` for your main website
- `public_html/wp-admin/error_log` for errors in the WordPress dashboard
- `public_html/yourotherdomain.com/error_log` for an addon domain

To read it:

1. In cPanel, open **File Manager** and go to your website's folder.
2. Open `error_log` with **View** or **Edit**. The newest errors are at the bottom.

Each line shows the date, the type of error, the message, and the file and line number, for example:

```
[15-Oct-2026 09:12:44 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function mb_strlen() in /home/cpuser/public_html/wp-content/plugins/example/file.php:42
```

The **file path** tells you which plugin, theme or script caused the error. See [Common PHP errors](https://helpcenter.ruachost.com/developers/php/common-php-errors/) for what the messages mean.

> **Tip:**
cPanel's **Errors** page (under **Metrics**) shows the latest web server errors, such as missing files and permission problems. It's useful when there's no `error_log` file.

`error_log` files can grow large and use your disk space. Once you've fixed the problem, it's safe to delete them. PHP creates a new one when the next error happens.

## Show errors on the page while you fix a problem

By default, errors aren't shown to visitors. This keeps file paths and other details private. To see errors on the page while you work:

1. In cPanel, open **Select PHP Version → Options**.
2. Set **`display_errors`** to **On**.
3. Reload the page that has the problem.
4. **Set `display_errors` back to Off** when you're done.

For one folder only, add `php_flag display_errors On` to that folder's `.htaccess` file. See [Custom PHP settings for one folder](https://helpcenter.ruachost.com/developers/php/custom-php-settings-per-directory-with-user-ini-files/).

### WordPress debug mode

In WordPress, the safest way is to log errors to a file without showing them to visitors. Add these lines to `wp-config.php` above `/* That's all, stop editing! */`:

```php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
```

Errors are then saved in `wp-content/debug.log`. Set `WP_DEBUG` back to `false` when you're done.

## Choose which errors are reported

**`error_reporting`** in **Select PHP Version → Options** controls which errors PHP reports. The default reports all errors except "deprecated" notices, which warn about code that will stop working in a future PHP version. Choose `E_ALL` to see those too, for example before upgrading PHP.

## Turn off error logging

You can set **`log_errors`** to **Off** in **Select PHP Version → Options**, but we don't recommend it: without a log, problems are much harder to find. It's better to fix the errors filling the log.

## Related articles

- [Fixing the 500 Internal Server Error while running PHP](https://helpcenter.ruachost.com/developers/php/fixing-the-500-internal-server-error-message-while-running-php/)
- [Changing your PHP version and settings](https://helpcenter.ruachost.com/cpanel/software/changing-php-versions-and-settings-using-php-selector/)
