Struggling to debug php? Enable all errors

If you are having a problem debugging any php code a good thing to do is make sure all errors are showing. Simply use the following code at the beginning of your script:

{code type=php}error_reporting(E_ALL);{/code}

You may find that the open source code you are using or the website created by somebody else is hiding too many errors for you to work out what is going on.

Keep in mind you will also see a lot of warnings which are not always important (depending on your personal opinion) – if this is the case make sure you remove the above line after you are done.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *