How to enable the Virtual Directory Support php?

a 夏天 提交于 2020-01-02 08:12:39

问题


I see "Virtual Directory Support" is disabled in phpinfo.php, how can I enable it ?


回答1:


In short: You can't easily. And you should not.

Longer story: PHP is supposed to provide a shared nothing environment. In this context this means if two scripts are running in parallel they should not interfere. In most cases this is no issue as different scripts use different processes. (Apache module with mod_prefork, FastCGI, fpm etc.)

But in some scenarios people use PHP as a module in a threaded environment. (Microsoft IIS module, Apache mod_mpm module etc.) If that is the case PHP can't rely on the operating system to separate context but has to do it itself.

One relevant area is the current working directory. The option you mentioned is about that and the name is misleading: it is not "Virtual Directory Support" but "Virtual Current Working Directory Support". It is an abstraction for file system operations.

So when having two PHP requests in different threads and code like include "./foo.php";, you want that to be relative to the request's main script and not the global state of the environment. VCWD support does that. As it is only relevant for threaded environments enabling/disabling is bound to the setting whether PHP is built thread safe or not, which is done at compile time. Unless you need to, this is off.

As a user you shouldn't care about it - it is not related to the ability to use streams or something from your PHP script.




回答2:


Compiling with --enable-maintainer-zts should do it.
But make sure you know what it does, here is an explanation.



来源:https://stackoverflow.com/questions/25415628/how-to-enable-the-virtual-directory-support-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!