PHP error- failed to open stream

This error message indicates that a file cannot be opened using the fopen function , this is due to permissions or not being able to find the file.

The following causes occur:
  • The file path is incorrect
  • The file path is relative
  • include path is incorrect
  • permissions are incorrect or incomplete for the file

A common error message is not using the absolute path to the file. This is easily solved by using the full path or using magic constants such as __DIR__

or dirname(__FILE__)

More information about this error message can also be found on the php.net page.