PHP errors often seem cryptic, but almost every error message points directly to the cause if you know where to look. First enable error reporting to make errors visible, then check the correct log file and tackle the most common error types step by step. With the right settings in PHP and Plesk, you’ll resolve most issues within minutes.
Recognizing types of PHP errors
PHP has various error levels, and the type of error determines how urgently you need to take action.
- Parse error: a syntax error, such as a missing semicolon or brace. The site usually stops working entirely.
- Fatal error: a function or class doesn’t exist, or a file can’t be loaded. Often the cause of a white screen.
- Warning: something goes wrong, but the script continues running. Think of a missing array value.
- Notice/Deprecated: less serious, but often indicates outdated code that will cause problems with a newer PHP version.
A message like Fatal error: Uncaught Error: Call to undefined function literally means that PHP doesn’t recognize a function, for example because a plugin or module is missing.
Setting up error reporting and logging
To fix errors, you first need to be able to see them. By default, displaying errors on a live site is often disabled, and rightly so: you don’t want to show error messages with server paths to visitors. Instead, you log errors to a file.
Set the following in your php.ini or via a .user.ini:
display_errors = Off(on production)log_errors = Onerror_reporting = E_ALLerror_log = /path/to/php_errors.log
In Plesk, you can easily find the PHP settings and corresponding error log per domain under the ‘PHP Settings’ and ‘Log Files’ sections, so you don’t need to search through configuration files yourself.
Solving common errors
Most PHP errors fall into a limited number of categories:
- Undefined function/class: check whether the correct PHP extension is enabled, or whether a file with a require/include hasn’t been loaded.
- Undefined variable/array key: check whether a variable exists before using it, for example with
isset(). - Memory limit exceeded: increase the memory_limit in php.ini, but also find out why a script needs so much memory.
- Maximum execution time exceeded: a script takes too long, often due to a heavy query or external call without a timeout.
- Class not found: usually a missing autoloader, for example after forgetting to run
composer install.
After updating your website or switching PHP versions, new error messages can suddenly appear because outdated code is no longer compatible. Therefore, test the main pages of your site after every PHP version switch.
Step-by-step plan for a white screen or 500 error
A white screen (‘white screen of death’) or an internal server error often doesn’t show a direct error message on screen. Follow this step-by-step plan to quickly find the cause.
Check the error log
Open the PHP error log in Plesk or via FTP and look for the most recent line showing a fatal error or parse error.
Temporarily enable display_errors
On a test environment, enable display_errors to see the error message directly on screen, including the file name and line number.
Go to the line mentioned
Open the file mentioned in the error message and check the specified line for syntax errors, missing brackets, or an incorrect function name.
Check recent changes
Was a plugin, theme, or PHP version recently changed? Revert the change to confirm whether this is the cause.
Restore from a backup if necessary
If you can’t quickly find the error, restore a recent daily backup and then reapply changes step by step.
For email-related PHP scripts, such as contact forms that send mail, it’s also wise to check whether your business email is correctly configured, so error messages don’t accidentally end up in a spam filter. If you’re unsure whether your hosting is properly set up for error tracking, check out the options for web hosting with Plesk and log access. If you get stuck, you’ll find more explanation in the knowledge base.
Frequently Asked Questions
Why don’t I see an error message, just a white screen?
This usually happens because display_errors is turned off. Check the PHP error log, the error will be listed there.
How do I find the PHP error log in Plesk?
Go to your domain, open ‘Log Files’ and select the PHP error log, or view the location via the domain’s PHP settings.
Can switching PHP versions cause errors?
Yes, functions can become outdated or removed in a newer version. Test the main pages after every switch and adjust code where necessary.
What do I do if I really can’t find the error?
Restore a recent backup or contact your hosting provider via WhatsApp, ticket, or email for help analyzing the log file.
Conclusion
Solving PHP errors starts with visibility: enable logging, read the correct log file, and go directly to the line mentioned. With a fixed step-by-step plan and access to log files in Plesk, you can resolve most issues yourself, and 24/7 support is available if in doubt.