Home  >  Article  >  Backend Development  >  What to do if php include error occurs

What to do if php include error occurs

藏色散人
藏色散人Original
2021-03-19 10:33:002676browse

Solution to php include error: 1. Check whether the location of the include file is correct; 2. Check whether the read permission of the included file is open; 3. Check the x of each directory on the included file path Whether the permission is open.

What to do if php include error occurs

The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer

Solution to the include file error in the php script

Often when the php page uses include, require, require_once to include some pages in other locations, errors will occur, such as the page is not found, or permissions are not allowed, etc. You can use the following methods to solve it Troubleshooting

1. When an error similar to "File not found" occurs, check whether the location of the include file is correct. The following quotes the original words of the PHP manual page:

The following is the quoted content:

Files for including are first looked in include_path relative to the current working directory and then in the directory of the current script. E.g. if your include_path is libraries, current working directory is /www/, you included include/a.php and there is include "b.php" in that file, b.php is first looked in /www/libraries/ and then in /www/include/. If filename begins with ./ or ../, it is looked only in include_path relative to the current working directory.

2. When an error similar to permission deny occurs, follow the following methods to eliminate it

a) Check whether the read permission of the included file is open

b) Check whether the included file is open Whether the x permission of each directory on the file path is turned on, this permission determines whether the directory can be browsed.

【Recommended: PHP Video Tutorial

The above is the detailed content of What to do if php include error occurs. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn