Membership
Main Menu
Forum Boards
Stats
- 18 tutorials
- 72,301 members
- 696,033 forum posts
- 11 blog posts
Tutorials
Debugging: A Beginner's guide
Views: 25999
Syntax Errors
Syntax errors. Eugh. We've all been there -- a nasty error message and we don't know what it means.
However, sometimes people don't even get as far as seeing the error message: they have PHP setup so that it won't display them. Handy for a live site; but rubbish for something in development. So turn them on! Either do this through your php.ini file (you're looking for the display_errors setting) or through the ini_set function. You can add this to the top of your code:
Note: Unfortunately, if your error is syntactical, then you'll need to make this change to your php.ini. If PHP can't parse the page correctly, then the change to the setting won't be made. (with thanks to philipolson for mentioning this)
This is often the cause of the 'My page shows nothing!' problem, which is seen so often on the forum. That is, there's a syntax error, but it's not being displayed.
Right, now that we're not flying blind and we're actually going to see our errors, we can move onto fixing them on page 3.
