A workaround for using include in PHP scripts to include file errors

Source: Internet
Author: User
Often when the PHP page in the use of include, require, require_once contains some other locations of the page, there will be errors, such as no time to find the page, or permissions are not allowed, can be excluded according to the following methods

1. When an error like "File not Found" appears, check that the include file is in the correct location, referring to the following quote from the PHP manual page:
Files for including is first looked in include_path relative to the current working directory and then in the directory O f the current script. e.g. if your include_path is libraries, current working directory is/www/, you included include/a.php and there are includ E "b.php" in this 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 a permission deny similar error occurs, the following method is used to exclude
A) detect if the included file Read permission is open
b) detects if the X permission on each directory on the included file path is open, which determines whether the directory can be browsed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.