How to hide php errors

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
HTF
Forum Newbie
Posts: 7
Joined: Sun Nov 15, 2009 7:22 am

How to hide php errors

Post by HTF »

Hello,

How can I hide php errors like this below for example when I'm accesing my website(I've just changed index file extensions for this example purpose but I had such a errors before):
PHP Warning: include(ip/index.pphp): failed to open stream: No such file or directory in C:\Web\DarkSpace\index.php on line 53
PHP Warning: include(): Failed opening 'ip/index.pphp' for inclusion (include_path='.;C:\php5\pear') in C:\Web\DarkSpace\index.php on line 53
Is it possible that instead of this the browser will be display some HTTP error like error 400 (Bad request) for example or somethomg like that, because in this case everybody see my directory structure ect.

Regards
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: How to hide php errors

Post by John Cartwright »

..or you could fix the error?

However, you can capture PHP generated errors and notices with set_error_handler()
HTF
Forum Newbie
Posts: 7
Joined: Sun Nov 15, 2009 7:22 am

Re: How to hide php errors

Post by HTF »

Hello,

Basically I have IP tool on my website that is showing visitors IP but I saw today that sometimes there is a slightly delay when the page is loading because of the website that provide the IP data, it's also displaying country flag ect. and I received php error about timing out (60 sec.) during loading the page so I would like to prevent from displaying this error or find some solution in situation when their website is slow what cause that my website is not loading.

I've change 'the display_errors to off' in php.ini so I could prevent from displying any php errors but it's also not working.

Your suggestion was great and I though that it will solve the problem but unfortunately not
Post Reply