Home >Backend Development >PHP Tutorial >Solution to error when using include file in php script
Often when the php page uses include, require, require_once to include some pages in other locations, errors will occur, such as no secondary page found. , or the permissions are not allowed, etc., you can eliminate it according to the following methods
1. When an error similar to "File not found" occurs, check whether the location of the include file is correct. The following quote## Original words from the #php manual page: 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 exclude it
a) Detect inclusion Whether the file read permission is turned on
b) Check whether the x permission of each directory on the included file path is turned on. This permission determines whether the directory can be browsed.
The above is the detailed content of Solution to error when using include file in php script. For more information, please follow other related articles on the PHP Chinese website!