18.104.22.168. Error "Fatal error: require * (): Failed opening required"
At When working with a call to files to connect to the current script, an error may occur:
Fatal error: require*(): Failed opening required ~/example.com/www/example.php in /home/example/example.com/www/somefile.php
require*():— the function by which the script accessed the file. Instead of
requirethere may be other functions:
Failed opening required ~/example.com/www/example.php— the cause of the error. In this case, it is reported that the file
~/example.com/www/example.phpcannot be found at the specified path or cannot be accessed.
in /home/example/example.com/www/somefile.php— the file from which another file was accessed. This information can be useful for debugging.
The most common causes of this error:
- The absence of a called file.
The most common reason is the absence of the called file. The problem can be observed when copying, moving or other actions with site files. Also, sometimes files can be deleted both by the user and by the scripts of the sites themselves, which is why such an error will occur.
- Invalid path to the called file.
If such a problem occurs, you should pay attention to the correctness of the path to the file specified in the error and the real path. It is important to note that there are certain directions that can be confusing when finding a path, for example:
/./— means the current directory. In fact, it can be omitted along the way, since it does not carry any changes in addressing.
/../— means parent directory. It is often used in scripts to form relative paths. For example, the path
example.com/www/include/../vendor/somefile.phpis actually a way
- In Linux, the case of file and directory names is important. For example, if the script tries to access a file by the name
SomeFile.php, and in fact the file is stored in the file system under the name
somefile.php, then an error will occur that the file you are looking for was not found. Unlike Windows, files
somefile.phpthey are two different files.
- Invalid permissions for the searched file.
If the rights set for the file do not allow the group to read it, then it will not be opened by another script. To reset rights, it is recommended to use the functionality recovery rights by default. For correct operation, it is recommended to use the rights
640for files and