From the course: PHP for Web Designers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Tracking down parse errors - PHP Tutorial
From the course: PHP for Web Designers
Tracking down parse errors
Parse errors, like the ones shown on the screen here, are among the most common error messages that you're likely to see. Parse is the technical term for what happens to a PHP script when it's processed by the server. And if there's a mistake in the code, the PHP can't parse it. So, let's take a look at this error message, and see if we can find the problem in the code. It says unexpected if, and it tells us it's on line four. Now, let's go to the editing program, and look at this page. Line four, doesn't look to be anything wrong with that if to me. And in fact, there is nothing wrong with it. And this is what confuses a lot of people. It says it was on line four. What was on line four was an unexpected if. In other words, the error lies before that. If shouldn't be there. Why shouldn't it be there? Well, on line three, the semi-colon is missing. So, if we put that semi-colon in and save the page, go back to the browser and reload it. Oh dear. We've got another syntax error…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Dealing with PHP errors4m 15s
-
Why is my page blank or incomplete?3m 53s
-
(Locked)
Tracking down parse errors4m 32s
-
(Locked)
What to do with "failed to open stream"3m 22s
-
(Locked)
What does "headers already sent" mean?6m 18s
-
(Locked)
What does undefined index, variable, or constant mean?5m 52s
-
(Locked)
What on earth is T_ENCAPSED_AND_WHITESPACE?1m 59s
-
(Locked)
-