Can PHP operate a path other than the root of the server, such as a folder on the F-disk?

Source: Internet
Author: User
Tags php language
can PHP manipulate a path other than the root directory of the server?
Like a folder on the F drive.
Is there a way?
Ask the warrior to say deep-seated reasons, thanks!

Reply content:

can PHP manipulate a path other than the root directory of the server?
Like a folder on the F drive.
Is there a way?
Ask the warrior to say deep-seated reasons, thanks!

The so-called root directory of the Windows platform may refer to the system directory, or the drive letter directory.
The root directory in UNIX and LINUX/GNU systems refers specifically to root directories and '/'
Let's discuss your question.

Split Line

PHP is an explanatory language. An explanatory language program does not need to be compiled, and it needs to be compiled immediately by the PHP interpreter when running the program. There is no doubt here, the PHP interpreter is included in the PHP package (not a small explanation, there is time to turn over the information). We explain the PHP language in the local is not any use, with PHP is naturally to his expertise to do web development. Then we need a Web server software to drive the PHP interpreter, so that the browser and the server form the HTTP protocol communication.

PHP supports many Web server software: Apache, Nginx, Microsoft Internet Information Server (IIS), Personal Web Server (PWS), Netscape, iplant Server, oreilly Website Pro server, Caudium, Xitami, OMNIHTTPD, and more. Here we choose the most familiar Apache for example.

We can configure PHP to run as a CGI script or Apache module or fastcgi mode in Apache. The default, such as in the Windows platform, is basically to run as an Apache module. is Apache run interpreter, it is natural that we use the PHP language to delete and change files are Apache user identity to execute.

For example, the Apache configuration user and user group are www/www. (There is an Apache handbook of Jin Bu translations on the web, which is interesting to Google).

Windows platform (for many years do not use it, if the explanation is wrong please include)

    • FAT32 partition mode, there is no file permission on Windows. Naturally, no matter which disk the PHP is placed on. PHP can create files or folders as long as the system can access the drive letter.
    • NTFS partition, file permissions have been introduced. Here, you need to identify whether Apache users have permissions in the directory under which they want to operate, or if none of them can produce an action.

UNIX, Linxu/gnu

    • Excellent design of file system permissions. In addition to basic read and write execution permissions, you can define hidden properties and file special permissions, among other things. and Linux user management to build users and user groups. So we have to follow the file permissions and user rights to apply PHP action. Detailed information can be found in Google search. Linux file permissions |linux accounts and user groups.
Split Line

Permission section, I will not explain. Basically the underlying point of your needs is fundamentally complete.

Yes, we need to see if PHP's running users have write access to the target folder.
chmod +w Directory

  • 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.