How to enable the Virtual Directory Support php?

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

Answer1:

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, ...) 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 requests 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 of. 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.

Answer2:

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

人吐槽 人点赞

Recommend

Comment

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:How to enable the Virtual Directory Support php?