otuatail Posted April 6, 2011 Share Posted April 6, 2011 Hi I have an include page full of functions in a secure folder with htaccess. My problem is if the include file does not exsist, I get the following. Warning: include(secure/SecureFunctions.php) [function.include]: failed to open stream: No such file or directory in /home/fhlinux190/d/otoole.co.uk/user/htdocs/streetangels/index.php on line 3 Warning: include(secure/SecureFunctions.php) [function.include]: failed to open stream: No such file or directory in /home/fhlinux190/d/otoole.co.uk/user/htdocs/streetangels/index.php on line 3 Warning: include() [function.include]: Failed opening 'secure/SecureFunctions.php' for inclusion (include_path='.:/usr/share/pear-php5') in /home/fhlinux190/d/otoole.co.uk/user/htdocs/streetangels/index.php on line 3 TIA Desmond. Fatal error: Call to undefined function session_init() in /home/fhlinux190/d/des-otoole.co.uk/user/htdocs/streetangels/index.php on line 6 Is there any way to suppress this as it is giving hackers information. Quote Link to comment https://forums.phpfreaks.com/topic/232861-how-to-stop-errors-on-page/ Share on other sites More sharing options...
spiderwell Posted April 6, 2011 Share Posted April 6, 2011 the obvious answer is to put the missing file in there? Quote Link to comment https://forums.phpfreaks.com/topic/232861-how-to-stop-errors-on-page/#findComment-1197698 Share on other sites More sharing options...
otuatail Posted April 6, 2011 Author Share Posted April 6, 2011 Yes but large systems have many files and things can go wrong. A bug might appear the you never thought of. Best stop the error. or die(); can be faital but you could sayor die("Sorry. Error"); Quote Link to comment https://forums.phpfreaks.com/topic/232861-how-to-stop-errors-on-page/#findComment-1197701 Share on other sites More sharing options...
KevinM1 Posted April 6, 2011 Share Posted April 6, 2011 Yes but large systems have many files and things can go wrong. A bug might appear the you never thought of. Best stop the error. or die(); can be faital but you could sayor die("Sorry. Error"); No, the best thing to do is fix the error. Saying "I have a large system, it's too hard" is an excuse for not testing and releasing a buggy site. Quote Link to comment https://forums.phpfreaks.com/topic/232861-how-to-stop-errors-on-page/#findComment-1197703 Share on other sites More sharing options...
spiderwell Posted April 6, 2011 Share Posted April 6, 2011 do a simple if file exists check before trying to include it. Quote Link to comment https://forums.phpfreaks.com/topic/232861-how-to-stop-errors-on-page/#findComment-1197705 Share on other sites More sharing options...
PFMaBiSmAd Posted April 6, 2011 Share Posted April 6, 2011 On a live server, display_errors should be OFF and log_errors should be ON. You want to log the errors so that you know what is going on and can find and fix whatever is causing them. On a development system, display_errors should ON. Error_reporting should always be as least E_ALL or even better, it should be a -1 Quote Link to comment https://forums.phpfreaks.com/topic/232861-how-to-stop-errors-on-page/#findComment-1197706 Share on other sites More sharing options...
otuatail Posted April 7, 2011 Author Share Posted April 7, 2011 Ok Thanks this seems best do a simple if file exists check before trying to include it Can I test and exit(); if not. any sample code please. TIA Desmond. Quote Link to comment https://forums.phpfreaks.com/topic/232861-how-to-stop-errors-on-page/#findComment-1198272 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.