From the course: PHP for Web Designers

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

What to do with "failed to open stream"

What to do with "failed to open stream" - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

What to do with "failed to open stream"

This pair of error messages frequently confuses beginners. The No such file or directory in this location on line 15, is particularly confusing. The file name being in bold type distracts attention from the important information which is in the first half of the error message. Failed to open stream, means the file couldn't be opened for one reason or another. And it doesn't refer to your web page but to the include file that's listed right at the beginning. In this case, it's require/includes/top.php. The second error message tells you the consequence of not being able to open the include file. It's a fatal error in this case because require was used. When require can't find an include file, it gives up attempting to display the rest of the page, and this reference to include_path is where PHP looks for include files by default. It's normally defined in the PHP configuration, and it can be tricky for beginners to change because the setup is slightly different depending on the server's…

Contents