Troubleshooting
Enable PHP error logging and display
When a website shows a blank page or a 500 error, the PHP message that explains the cause is not visible by default. You can have it saved to a log file (recommended) or, for a few minutes, shown on screen.
Option 1: from .htaccess
This is the quickest way, and it only affects the website where you add it.
- In cPanel, open File Manager and go into
public_html(or the folder of the failing domain). Turn on Show Hidden Files in Settings if you cannot see.htaccess; if it does not exist, create it. - Add at the top of the file:
php_value error_reporting -1 php_flag display_errors Off php_flag log_errors On php_value error_log /home/USUARIO_CPANEL/error_log
- Replace
USUARIO_CPANELwith your cPanel username (it appears in cPanel's right-hand column, under General Information). - Reload the failing page.
Errors will be saved to the error_log file in the account's main folder, outside public_html, so nobody can download it from the web. Open it with File Manager: the last lines are the most recent.
Option 2: from cPanel's PHP selector
- In cPanel, go to Select PHP Version and open the Options tab.
- Set
log_errorsto On. It is saved automatically.
This change affects all the websites in the account that use that PHP version. Errors are saved to an error_log file in the same folder as the failing script (usually public_html).
Show errors on screen
If you need to see the error directly in the browser, set display_errors to On: in .htaccess, with php_flag display_errors On, or in the Options tab of the PHP selector.
Only do this for as long as it takes to see the error and set it back to Off: the message can show any visitor internal paths or database connection details.
In WordPress you also have its own debug mode, which is explained in debug errors in WordPress.
How to read the error
Each line of the log shows the date, the error type, the message and the file and line where it happened, for example:
[27-Oct-2026 10:15:02 Europe/Madrid] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /home/usuario/public_html/wp-content/plugins/ejemplo/ejemplo.php on line 42
- Fatal error is what breaks the page; Warning, Notice and Deprecated usually do not.
- The path tells you the culprit: if it is inside
wp-content/plugins/ejemplo, the problem is in that plugin.
If the error_log does not appear
- Check that the cPanel username in the path is correct.
- If adding the lines to
.htaccesscauses a 500 error, remove them and use option 2. - If the page fails but nothing is logged, the error may not be a PHP one: check Metrics > Errors in cPanel.
When you finish, remove the lines from .htaccess or set log_errors back to how it was, and delete error_log so that it does not keep growing.
You may also find useful
- Debug errors in PHP applications or files Diagnose a blank screen or a 500 error by reproducing the failure and checking the most specific log...
- Log PHP errors for a specific file Capture errors from a single PHP file in a private, temporary log, keeping display_errors off so det...
- Xdebug: debug PHP code remotely with PhpStorm or NetBeans Enable Xdebug 3 in cPanel, open a reverse SSH tunnel from Linux, macOS or Windows (PuTTY) and connec...
- auto_prepend_file and auto_append_file Trace the request that reinfects an application by using auto_prepend_file to log only selected meta...
Something wrong or out of date? Tell us and we will review it.