Enable PHP errors to Display on Web Browser
Generally, displaying PHP errors in a web browser is not a good idea as hackers cannot collect information about your website.
However, when performing development or testing displaying PHP error may be very useful for troubleshooting purposes. This article will help you to enable PHP errors to display on the web browser.
See Also:
- HOW TO DOWNGRADE PHP 7.1 TO 5.6 ON UBUNTU
- HOW TO UPGRADE PHP 5.6 TO 7.1 ON UBUNTU
- MONGODB PHP MODULE (EXTENSION) ON CENTOS 5/6/7
- INSTALL PHPPGADMIN ON CENTOS & RHEL
Enable display_errors
First, we need to enable display_errors parameters using the PHP configuration file.
# vim /etc/php.ini
display_errors = on
Add Content in PHP script
After enabling display_errors to add the following line in your application index.php file or other default load script.
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
Here is a sample of index.php file with enabled PHP errors to display on the web browser.
Enjoy it!
No Responses