Is there any way I can tell PHP to NOT display full path of file having any error in Error, warning or notice messages. I know I can disable errors; But, just to avoid any risk.
For example: My script returns an error which is displayed like:
Fatal error: Call to undefined function shell_exec1() in /home/[user]/public_html/index.php on line 1
I want to display it like
Fatal error: Call to undefined function shell_exec1() in ~/index.php on line 1
This way, It'll be safer way to display error messages while not exposing full path of file to bad guys.
Is this possible? How?
As suggested above use custom error handler. BUT cut the path with the basename() to achieve what you want.
http://php.net/manual/ru/function.basename.php
Just write your own error handler. see: http://www.php.net/manual/en/function.set-error-handler.php