Document tree and PHP extension problems

Source: Internet
Author: User
The document tree and the PHP extension are found in the book PHP and MySQLWeb development. this text is not easy to understand. I hope the experts can answer this question. & nbsp; PHP does not view the required file extension. This means that you can name the file without directly calling the file. When a file is loaded using the require () statement, it is executed as part of the PHP file. & Nbsp; generally, if PHP statements are placed in an HTML document tree and PHP extension problems
In the book "PHP and MySQL Web Development", I am not very familiar with such a paragraph. I hope you can answer it.
PHP does not view the required file extension. This means that you can name the file without directly calling the file. When a file is loaded using the require () statement, it is executed as part of the PHP file.
Normally, php sentences are not processed if they are placed in an HTML file (for example, page.html. PHP is usually used to parse files with extensions defined as. php. (This can be the same in the webserver configuration file. However, if this page.html file is downloaded through require( syntax, any PHP commands in the file will be processed. Therefore, you can use any extension to name the inclusion file, but try to follow a convention, such as naming the extension. inc is a good method.
Note that if the extension is. inc or some other non-standard extension files are stored in the Web document tree, and users can directly load them in the browser, users can view the source code in the form of common text, include any password, so it is important to save the included files outside the document tree or use the standard file extension.

As mentioned in this article, it is a good way to name the extension as. inc. why? Secondly, what is the document tree mentioned in it? Finally, how to save the contained files outside the document tree

------ Solution --------------------
This means to prevent the contained php file from being out of the website document directory and ensure that apache running users have the right to access this directory.

For example, if the default directory of apache is/var/htdoc, you can name the included PHP file. the suffix of inc is placed in the/var directory, so that the browser cannot access the files under/var.

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.