Disabling PHP Errors on VS
On hosting, it is necessary to disable the display of PHP errors in the browser. Firstly, it scares users and indicates poor website quality; secondly, errors can provide hints to hackers during the process of hacking the site.
Let's disable the display of errors. To start, let's create an error, for example, by outputting a non-existent variable:
<?php
echo $test;
?>
Now, let's use ini_set to enable the display
of errors and make sure that it is shown
in the browser:
<?php
ini_set('display_errors', 'on');
echo $test;
?>
And now let's disable the display of errors and make sure that it is no longer shown:
<?php
ini_set('display_errors', 'off');
echo $test;
?>
Disable the display of errors in the browser.