LordLanky Posted July 2, 2009 Share Posted July 2, 2009 Hi, I'm having real trouble debugging my code - my service provider just upgraded my php version to 5.2.1 and ever since - i cant seem to do debugging the way i used to. At the top of each file on my website, i have an include which sets: error_reporting(E_ALL); Which gives me errors, fine and dandy. However, it's a complex website with LOTS of functions. I am trying to debug a specific function the old fashioned way of echoing line numbers here and there and seeing what route they take (i'm sure there are better ways, but hey!). At the bottom of each page is a redirect depending on the outcome of the relevant functions. Usually, and intentionally, this would prevent the header("Location....") command from redirecting as 'outputs have already been given' - but for some reason now, it is redirecting!! can anyone help me either a) suggest an EASY alternative method - when i mean easy, i mean doesn't take much to use. echo __LINE__; is really quick and easy to type , or b) let me know how to re-break the header?! Thanks much in advanced - i've been smashing my head against a wall for a day now. Link to comment https://forums.phpfreaks.com/topic/164535-solved-php-redirecting-after-echo-please-help/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 2, 2009 Share Posted July 2, 2009 LOL - they have turned on output_buffering in the php.ini. You should disable it in your own local php.ini (when php is running as a CGI application) or in a .htaccess file (when php is running as an Apache Module). You should also be developing and debugging code on a local development system, not a live hosting web server. Link to comment https://forums.phpfreaks.com/topic/164535-solved-php-redirecting-after-echo-please-help/#findComment-867846 Share on other sites More sharing options...
czukoman20 Posted July 2, 2009 Share Posted July 2, 2009 Well.. From what i understand.. There is inconsistency with your Redirects.. it works.. or doesn't work.. What i do for redirecting anywhere is printf("<script>location.href='http://www.yoursite.com'</script>"); Hope that helps.. Link to comment https://forums.phpfreaks.com/topic/164535-solved-php-redirecting-after-echo-please-help/#findComment-867849 Share on other sites More sharing options...
LordLanky Posted July 2, 2009 Author Share Posted July 2, 2009 Hi, Thanks for that - I'd love to be developing locally - but a) i'm too tight to buy software and b) i'm on Windows which likes to 'gently pursuade' you to use .net! I'll try disabling/enabling then get back to you. Thanks for the INCREDIBLY rapid response! Link to comment https://forums.phpfreaks.com/topic/164535-solved-php-redirecting-after-echo-please-help/#findComment-867851 Share on other sites More sharing options...
PFMaBiSmAd Posted July 2, 2009 Share Posted July 2, 2009 Apache, PHP, and MySql are all free and work under current Windows operating systems (support for Win98 has been dropped in the latest php version.) Link to comment https://forums.phpfreaks.com/topic/164535-solved-php-redirecting-after-echo-please-help/#findComment-867856 Share on other sites More sharing options...
LordLanky Posted July 2, 2009 Author Share Posted July 2, 2009 Curse your expert knowledge! you make me seem lazy Anyway, back to the question... The contents of my php5.ini file are: memory_limit=16M short_open_tag = 1 upload_max_filesize = 4M output_buffering = Off - this now does display an echo - but on the following page - therefore it still redirects. However, there are occasions where i use a transaction page (i.e. redirect to a page that does actions - this is for security reasons - then redirect somewhere else) meaning that the echo wont appear as the transaction page lasts only a split second. Any advice? Thanks muchos again! Link to comment https://forums.phpfreaks.com/topic/164535-solved-php-redirecting-after-echo-please-help/#findComment-867864 Share on other sites More sharing options...
PFMaBiSmAd Posted July 2, 2009 Share Posted July 2, 2009 Are these script files in the same folder/path? It sounds like either the php5.ini is not being used or only applies to the folder it is in (some server configurations require one in each folder, check with your host to know exactly.) Link to comment https://forums.phpfreaks.com/topic/164535-solved-php-redirecting-after-echo-please-help/#findComment-867873 Share on other sites More sharing options...
LordLanky Posted July 2, 2009 Author Share Posted July 2, 2009 You.... are.... my FAVOURITE PERSON IN THE WORLD right now! All sorted. Thanks dude. One in each folder done the job. Link to comment https://forums.phpfreaks.com/topic/164535-solved-php-redirecting-after-echo-please-help/#findComment-867881 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.