By default, the mybox infrastructure suppresses PHP error messages on live websites. This is a security measure designed to prevent sensitive information-such as file paths or database structures-from being visible to your visitors.
If your script is not working correctly, you may see a blank page (often called the “White Screen of Death”) or a generic error. To find the cause, you must manually enable error reporting to see the specific diagnostic messages.
Table of Contents
How to enable error reporting
The most direct way to debug a single script is to add a directive directly to your PHP file (e.g., index.php). Place the following code at the very top of your file, immediately after the opening <?php tag:
PHP
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Once this code is in place, refreshing your website will display any active errors, warnings, or notices directly in your browser.
Common causes for script errors
When analyzing the displayed errors, consider these frequent triggers:
- PHP Version Mismatch: Your script may use functions that were deprecated in newer PHP versions or require features not available in older ones.
- Missing Extensions: Some scripts require specific PHP modules (like
mbstring,imagick, orgd) that might not be active for your domain. - Syntax Errors: Simple typos or missing semicolons in your code will prevent the entire script from executing.
Practical Implications
- Security Risk: Never leave error reporting active on a production website. Once you have identified the problem, remove the code to keep your server paths hidden from the public.
- Version Adjustments: If the error indicates a “Deprecated function” or “Call to undefined function,” try changing your PHP version in the mybox panel to see if the script was designed for an older or newer environment.
- Error Logs: In addition to displaying errors on the screen, mybox logs these events in the background. You can often find a more detailed history by checking the
.logsfolder in your account via FTP or SSH.
Summary
Activating PHP error messages is an essential step for infrastructure literacy. By using the ini_set directive, you turn your website into a diagnostic tool, allowing you to bridge the gap between a non-functional script and a working solution.