Rick Kukiela
Rick Kukiela

Reputation: 1264

Prevent php from exposing include_path

Is there a way to prevent php from exposing the "include_path" value - server wide?

For example, if I do require("asdfasdf.php"); the error message results in saying what the include path is because it didnt find that file in the include path. I do not want php to expose this information.

Also, I'm aware there is a way to completely disable phpinfo(); However, is there a way to also hide the include_path value there instead?

Upvotes: 1

Views: 90

Answers (2)

TheAlexLichter
TheAlexLichter

Reputation: 7289

Option One

You can use @require("yourfile.php") or die("Couldn't include file"), so it'll suppress the error message of require but still gives out an error.


Option Two

The easiest way is to set error_reporting to zero inside the php.ini (or inside the script with error_reporting(0);) or at least don't display the errors (ini_set('display_errors', 0);).

Upvotes: 1

Kurt Larsen
Kurt Larsen

Reputation: 391

Opion three

ini_set('display_errors', 0); // Turns off error rapporting

Upvotes: 0

Related Questions