1 00:00:00 --> 00:00:04 Right now I am onto the last two common errors that I have included. 2 00:00:05 --> 00:00:08 And we will start with the hard one. 3 00:00:09 --> 00:00:13 This is php header and we are using "header" function going to a location. 4 00:00:14 --> 00:00:17 And here I have got some html code. 5 00:00:18 --> 00:00:20 This is a header tag, I am saying "Welcome!". 6 00:00:21 --> 00:00:25 And our "goto" variable is "google dot com". 7 00:00:26 --> 00:00:34 If the "goto" exists, which it currently does, we are going to redirect the page to a u-r-l "google dot com". 8 00:00:35 --> 00:00:36 Right now, this will return an error. 9 00:00:37 --> 00:00:49 And the error is - Oh! um... Okay that’s why. "o b start". 10 00:00:50 --> 00:00:55 Lets get rid of this. That wasn’t supposed to be there. That code is to fix the error! 11 00:00:56 --> 00:01:02 Sorry, so we will go to "php header" and we have got "Welcome!" - our html code. 12 00:01:03 --> 00:01:09 Then a warning - "Cannot modify header information – headers already sent by..." and all of this. 13 00:01:10 --> 00:01:15 Okay so our headers have already been sent. This is the line no. by the way. 14 00:01:16 --> 00:01:25 1, 2, 3 so if it gives you an error like "phpheader dot php" colon 3, then the error has occurred on the line no. 3. 15 00:01:26 --> 00:01:31 So that's where the error is - on line 3, okay? 16 00:01:32 --> 00:01:38 And this error has been generated by line 9, which if you go here, is our "header" function. 17 00:01:39 --> 00:01:46 So the reason that this is happening is we are already sending our html code. 18 00:01:47 --> 00:01:53 If I get rid of this by commenting it, and I were to refresh then we would be redirected to google. 19 00:01:54 --> 00:01:58 But the point is that we want this welcome header here. 20 00:01:59 --> 00:02:09 And you can’t actually put html before a header function, going to location and other features of this function. 21 00:02:10 --> 00:02:14 You shouldn't do so. 22 00:02:15 --> 00:02:19 So as you saw a minute ago that is "ob underscore start". 23 00:02:20 --> 00:02:24 What this does is, it fixes this problem for us. 24 00:02:25 --> 00:02:36 So I can come here to "phpheader" and it works, even though I have still got my html code echoed here before my header. 25 00:02:37 --> 00:02:46 So without this we get an error (pause) and with this our header works fine, okay? 26 00:02:47 --> 00:02:52 Despite the initial rule of no html output before header up here. 27 00:02:53 --> 00:02:54 That should be pretty clear by now. 28 00:02:55 --> 00:02:57 Now, the last one is extremely simple. 29 00:02:58 --> 00:03:01 I don’t even need to explain it but anyway. 30 00:03:02 --> 00:03:07 This is "include a file which doesn’t even exist" named as "idontexist dot php". 31 00:03:08 --> 00:03:12 So lets have a look. Um.. where is it? "missing dot php". 32 00:03:13 --> 00:03:15 Oh no! Its not. "open dot php". 33 00:03:16 --> 00:03:24 Okay! So - include "idontexist dot php" failed to open stream; no such file or directory in that name here. 34 00:03:25 --> 00:03:26 Our file name and directory on line 3. 35 00:03:27 --> 00:03:29 So lets come to line 3. 36 00:03:30 --> 00:03:34 And that is the only line of significant code in this file. 37 00:03:35 --> 00:03:42 We have another warning here - Failed to open "idontexist dot php" for inclusion and all of this. So we get two errors. 38 00:03:43 --> 00:03:49 This is quite messy when you have a page that has "include a header file". 39 00:03:50 --> 00:03:56 Then these don’t look too nice. I mean you have probably been in a website before and you have seen this at the top. 40 00:03:57 --> 00:04:01 You need to be attractive. So you can put a "@ (at)" symbol in front and refresh. 41 00:04:02 --> 00:04:05 That won't show the error anymore. 42 00:04:06 --> 00:04:09 But it doesn’t excuse the fact that the file doesn’t exist. 43 00:04:10 --> 00:04:13 So the content of the file which doesn’t exist, won’t be included. 44 00:04:14 --> 00:04:22 But yes, to be honest, looking at this, this is really pretty much self explanatory. I just thought I should explain this anyways. 45 00:04:23 --> 00:04:29 So we have got a small collection of errors that you might come across when you are programming in php. 46 00:04:30 --> 00:04:38 If there are other errors that you are getting, then please message me and I will be happy to help. 47 00:04:39 --> 00:04:44 Please subscribe for latest updates. Thanks for watching. This is Evan Varkey dubbing for the Spoken Tutorial project.