Failed opening required %s (include_path=%s)

Description

This error appears when PHP cannot reach the file for inclusion with require or require_once.

The file may not exist, or the path has a typo and does not point to the actual file. Note that PHP searches for the file once, when the path starts with a leading /. Otherwise, PHP uses the provided path with all the paths provided in the include_path, and stops at the first found file.

The file may be configured no read permissions, making it unavailable for the web server or anyone running the current code.

Parenthesis have no impact on this error.

This error applies only to require and require_once. It does not apply to include and include_once, which reports the same message but proceeds with execution and does not stop with a fatal error. Note that the underlying problem is the same, but the reaction of the inclusions are not the same.

Example

<?php

    require '/not/a/path/to/a/file.inc';

?>

Literal Examples

  • Failed opening required include.php (include_path=’.:’)

Solutions

  • Check for typos in the file name.

  • Check for typos in the path name.

  • Check for permissions to reach the file.

  • Check for include_path to provide the correct path prefix.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.