简体   繁体   English

根文件系统在Windows中是否存在,尤其是在Windows 10中?

[英]Does the root filesystem exist in Windows, especially in Windows 10?

I'm using a laptop that runs on Windows 10 Home Single Language 64-bit Operating System 我正在使用在Windows 10 Home Single Language 64位操作系统上运行的笔记本电脑

I've installed the latest version of XAMPP pre-configured installer on this laptop. 我已经在此笔记本电脑上安装了最新版本的XAMPP预配置安装程序。

This has installed PHP 7.2.12 and Apache/2.4.37 (Win32) on my laptop. 这已经在我的笔记本电脑上安装了PHP 7.2.12Apache / 2.4.37(Win32)

I come across below note from the PHP Manual : 我从PHP手册中注意到以下内容:

Note: 注意:

The Apache web server changes the directory to root at startup, causing PHP to attempt to read php.ini from the root filesystem if it exists. Apache Web服务器在启动时将目录更改为根目录,从而导致PHP尝试从根文件系统读取php.ini(如果存在)。

This note has created couple of doubts in my mind which are as below : 此说明在我的脑海中产生了以下几个疑问:

  1. Does the root filesystem exist in Windows, especially in Windows 10 which I'm currently using on my laptop? 根文件系统在Windows中是否存在,尤其是在笔记本电脑上当前正在使用的Windows 10中? If it does exist then which directory in Windows act as the root directory? 如果确实存在,那么Windows中哪个目录充当根目录?
  2. If it does not exist then to which directory the Apache web server changes at startup in order to make PHP attempt to read php.ini? 如果不存在,那么Apache Web服务器在启动时会更改到哪个目录,以使PHP尝试读取php.ini?

I hope someone would clear my above doubts with some good explanation which would be in simple, lucid language and which should be easy to understand for me. 我希望有人用一些简单明了的语言,对我来说应该很容易理解的良好解释,来消除我的疑虑。

Thank You. 谢谢。

"Root" on *nix systems refers to the top-level folder. * nix系统上的“ Root”是指顶级文件夹。 It looks like this: / 看起来像这样:/

So the answer to your first question is: Yes, the root folder just means the top-level folder where the OS is installed, which on a default Windows set-up is the C:\\ folder. 因此,第一个问题的答案是:是的,根文件夹仅表示安装操作系统的顶级文件夹,在默认Windows设置下该文件夹为C:\\文件夹。

The answer to your second question is more tricky, since I'm not sure how Apache behaves on Windows. 第二个问题的答案比较棘手,因为我不确定Apache在Windows上的行为。 The note on the PHP manual page that has you concerned is only referring to *nix environments. 您所关心的PHP手册页上的注释仅指* nix环境。 This is a long-standing issue with PHP and Apache, in that they were both "born" out of *nix, and that is where they are most at home. 对于PHP和Apache,这是一个长期存在的问题,因为它们都是“ * nix”的“天生”,而这正是它们最常出现的地方。 They have been ported to Windows, but as an afterthought. 它们已被移植到Windows,但这只是事后的想法。 I would highly recommend that you acquire a *nix development environment as soon as possible if you are going to be doing a lot of PHP development, because you will keep running into these kind of issues where the documentation is not intended for Windows users. 如果要进行大量的PHP开发,我强烈建议您尽快获取* nix开发环境,因为您将不断遇到此类问题,这些文档不是针对Windows用户的。

I believe that Apache on Windows will, by default, look for the php.ini file in the ServerRoot folder, which is set in httpd.conf. 我相信默认情况下,Windows上的Apache将在ServerRoot文件夹中查找php.ini文件,该文件位于httpd.conf中。 (Someone correct me if I'm wrong!) But if you want to place your php.ini file in a custom location, you can add a line like this to httpd.conf: (如果我错了,请纠正我!)但是,如果要将php.ini文件放在自定义位置,则可以在httpd.conf中添加以下行:

PHPIniDir "C:\\php\\ini" PHPIniDir“ C:\\ php \\ ini”

The root folder for the system is C:/Windows. 系统的根文件夹是C:/ Windows。 But it has nothing to do with reading php.ini, because generally all configuration files (php, apache and mysql) are properly read every time. 但这与读取php.ini无关,因为通常每次都会正确读取所有配置文件(php,apache和mysql)。 Mostly, I install xampp directly in c:/. 通常,我直接在c:/中安装xampp。 The path of xampp will be c:/xampp and everything works fine. xampp的路径为c:/xampp ,一切正常。

I also installed apache, php and mysql manually and separately without using wamp or xampp. 我还手动安装了apache,php和mysql,而没有使用wamp或xampp。 And these will be placed directly under c:/ , so that the paths would be c:/php , c:/Apache24 (for Apache 2.4) and c:/mysql . 这些将直接放在c:/ ,因此路径将为c:/phpc:/Apache24 (对于Apache 2.4)和c:/mysql So it doesn't matter. 所以没关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM