ZulfadlyAshBurn Posted August 11, 2011 Share Posted August 11, 2011 Does anyone knows how to create their own debugging script for php? The only thing that I am able to do now is when a user encounter an error when browsing the site, the user will still see the page but with error while an email is being send to me at the same time. Is there anyway to prevent this from happening? Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/ Share on other sites More sharing options...
Maq Posted August 11, 2011 Share Posted August 11, 2011 You should be testing locally with error reporting turned on to max. When you are testing your code/site you should catch and handle errors and exceptions appropriately. Also, look up unit testing for you application. Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255899 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 11, 2011 Author Share Posted August 11, 2011 i check my scripts before transferring to my server. but sometimes, my server displays unwanted glitch witch doesn't happen locally. Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255905 Share on other sites More sharing options...
KevinM1 Posted August 11, 2011 Share Posted August 11, 2011 Also, a user should never see a PHP/database error. You should have a generalized error screen/helpful 404 screen, which would also do whatever logging you need to do behind the scenes. Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255906 Share on other sites More sharing options...
Maq Posted August 11, 2011 Share Posted August 11, 2011 i check my scripts before transferring to my server. but sometimes, my server displays unwanted glitch witch doesn't happen locally. What? Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255914 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 11, 2011 Author Share Posted August 11, 2011 sorry for the spelling error, *which. HAHA. erm, its usually some on my local server, I can place headers somewhere in the middle of the code for redirection. but when i upload to my server, it disallows. Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255918 Share on other sites More sharing options...
Maq Posted August 11, 2011 Share Posted August 11, 2011 sorry for the spelling error, *which. HAHA. erm, its usually some on my local server, I can place headers somewhere in the middle of the code for redirection. but when i upload to my server, it disallows. Did you edit your php.ini locally to have error reporting turned to the maximum? Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255925 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 11, 2011 Author Share Posted August 11, 2011 error_reporting(E_ALL); ini_set('display_errors', '1'); i use this code? Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255928 Share on other sites More sharing options...
AyKay47 Posted August 11, 2011 Share Posted August 11, 2011 for localhost debuggin yes, however on a live server you will want display errors off, so users do not see the errors.. Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255930 Share on other sites More sharing options...
Maq Posted August 11, 2011 Share Posted August 11, 2011 error_reporting(E_ALL); ini_set('display_errors', '1'); i use this code? Yes, that temporarily sets error reporting to max. So your header calls work fine locally and not on live? What does disallow mean here? but when i upload to my server, it disallows. Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255936 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 11, 2011 Author Share Posted August 11, 2011 Locally: headers(); place in middle of the page etc, it can work. Online: Cannot modify header information - headers already sent by (output started at /home/***/public_html/***/index.php:9) in /home/***/public_html/***/index.php on line 186 Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255950 Share on other sites More sharing options...
Maq Posted August 11, 2011 Share Posted August 11, 2011 Locally: headers(); place in middle of the page etc, it can work. Online: Cannot modify header information - headers already sent by (output started at /home/***/public_html/***/index.php:9) in /home/***/public_html/***/index.php on line 186 Yes, that is a very common error. So common that we even made a sticky for it, check out: http://www.phpfreaks.com/forums/index.php?topic=37442.0 Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255952 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 11, 2011 Author Share Posted August 11, 2011 cool, i'll go read it. but for how do i make sure that all errors are forwarded to me and make the page unavailable to users if there is error. Quote Link to comment https://forums.phpfreaks.com/topic/244498-debugging/#findComment-1255958 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.