How does one go about debugging PHP? I have an open source CMS php web site. The template / theme that I have has some issues. I have tried looking online for a solution along the expected and typical paths but they have reached a dead end. So I have decided to do it the hard way and actually get into the code and find the error Any suggestions on how I should begin?
HELLo, If you have issues with the HTML / CSS, the your first step would be the inspector in Chrome / Safari. Right click the problem area and select "Inspect element" (Unsure if thats the exact phrase in english). This will open a new pane where you will see all the html / css, you can even edit the html / css directly in the inspector to see the changes live. (Tho, nothing is saved of course). This will at least give you a starting point at figuring out what HTML that goes wrong, and when you know that, you need to figure what PHP file that generates the problem html. Bit unsure if this is the answer to your question, but please do explain a bit more further if the above doesn't help
Are you positive they are PHP errors? Normally it will show some message in the DOM if there is an actual error in the PHP code. Otherwise, it may be just some HTML/CSS/Javascript issues. In that case, the Chrome developer console (ctrl + shift + j in Chrome) will tell you where those errors may be. The only other way I have debugged software was to dig into the code myself reading it manually and tweaking things related to the error to see if it changes anything.
I recommend you from the firefox the firebug addon. You can change html and css on the fly. Also for php enable errors messages: ini_set('display_errors', '1'); error_reporting (E_ALL); PHP:
Place the following code in the start of the file to debug the PHP code: <?php ini_set('display_errors', 'On'); error_reporting(E_ALL);