Many website hosting provider/isp has turned off the display errors setting/feature in the php.ini file. This is making your websites more secure and protect your websites from harm.
However, you really need to know what problem with your php script while debugging your code. We have 2 ways to face with the issue:
1. Changing your display_errors setting in the php.ini file:
; This directive controls whether or not and where PHP will output errors, ; notices and warnings too. Error output is very useful during development, but ; it could be very dangerous in production environments. Depending on the code ; which is triggering the error, sensitive information could potentially leak ; out of your application such as database usernames and passwords or worse. ; It's recommended that errors be logged on production servers rather than ; having the errors sent to STDOUT. ; Possible Values: ; Off = Do not display any errors ; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) ; On or stdout = Display errors to STDOUT ; Default Value: On ; Development Value: On ; Production Value: Off ; http://php.net/display-errors display_errors = On |
But the display_errors setting should always Off on production environment to protect your website from attackers or bad guys.
Or if you are on shared hosting environment and of course, you do not have permission to change the display_errors setting so you need to think about another solution.
2. Using PHP ini_set function to turn the display_errors setting on
<?php ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . '/php_error_log.txt'); error_reporting(E_ALL); ?> |
By putting the php script above at the very beginning of your php file, it will overwrite your current display_errors setting and your errors or warnings should be shown. The script above also enable to log the errors/warnings and save them somewhere on your server.