45

debugging php code without turning on error reporting.

Comments
  • 1
    Binary Search Debug (BSD):
    1. Remove half of the code
    2. If it doesn't work, go to step 1. If it works, apply BSD to the code you just removed
    3. Profit
  • 1
    tail -f /var/log/httpd/error_log
  • 0
    @binaryfreedom that's a great solution IF you have access to it.
    Sometimes clients will only give you FTP access to the sites home folder.
  • 2
    @nerd-san true. The best approach otherwise is to use ini_set to override the runtime configuration temporarily.
  • 1
    @binaryfreedom
    well, look who has an answer for everything.
    ; p
  • 0
    You can also download everything and run it on local server with all error reporting on or that ini set but it's less secure
  • 0
    @binaryfreedom
    however,
    ini_set can be disabled for 'security' reasons, or the site is live and you can't be showing errors, or, the previous codders code was so not best practices you would be flooded with so many unrelated or depricated warning errors that it breaks the page.
    There are occasions where showing the errors for the page just isn't possible, or would make things worse.
  • 1
    @nerd-san you are absolutely right. There are cases where none of the above works. Look, I am not trying to belittle your achievement, I was just trying to point what I may have tried. Debugging without error reporting sucks and I believe that's a statement we can all agree. Peace!
  • 0
    @binaryfreedom
    no offence taken and hopefully none given.
    it's not always simple to convey intention.
    I wasn't trying to come off as defensive, so sorry for that, and offering advice is always an awesome thing to do, so thanks for that, please don't stop because of me.
    the original feeling I was trying to convey wasn't a, 'oh no help,' but more of a, 'working without a net confidence. ' That being said, all the suggestions people have made to work around this problem has been great, and I would be remiss if I didn't acknowledge that I will definitely benefit from some of them.

    my bad forgetting that devs will always try to come up with solutions and are supper willing to help each other.
  • 2
    Just die() try catching
Add Comment