You can enable the display of PHP errors to identify issues during the development of a website. This process allows you to see specific error messages and warnings directly in your browser instead of seeing a blank page or a generic server error.
Important: Only enable error display during the development phase. You should disable error reporting on a live production website to prevent sensitive system information from being exposed to the public.
Before you begin
You will need:
Access to your website's file system via an FTP client or a File Manager.
A local copy of the site or a development environment where it is safe to display errors.
Displaying PHP errors via .user.ini or php.ini
Depending on your server configuration, you can enable error reporting by modifying a .user.ini or php.ini file in your website's root directory. This is not available on Shared Windows packages.
Connect to your server using an FTP client or your hosting control panel's File Manager.
Navigate to the root directory of your website (typically
public_htmlor a folder named after your domain).Locate the
.user.inifile. If it does not exist, you may need to create it.Open the file and add or modify the following lines:
display_errors = On display_startup_errors = On
Save the file and refresh your website to see if errors appear.
Displaying PHP errors via a script
If you cannot modify the global configuration files, you can enable error reporting for a specific script or page by adding PHP code directly to your file.
Open the specific PHP file where you are experiencing issues (e.g.,
index.phpor a plugin configuration file).Add the following code block at the top of the file, immediately after the opening
<?phptag:ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);Save the file and refresh the page.
Confirm the result
When a PHP error occurs, the specific error message, file path, and line number will appear directly on the webpage.
The page will no longer appear as a blank white screen when a script fails.
How to stop displaying PHP errors on a production website
Once you have finished your development and moved your site to a live environment, you must disable error reporting to maintain security.
Access your
.user.iniorphp.inifile via FTP or File Manager.Change the values to:
display_errors = Off display_startup_errors = Off
Save the file.
Limitations
These changes only affect the display of errors in the browser. They do not stop the errors from being recorded in the server's internal error logs.
If your server's global configuration overrides your local
.user.inifile, you may need to contact Hostek support to verify the correct file to edit.
