|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #74818 opcache.file_cache should not require drive letter paths
Submitted: 2017-06-26 17:02 UTC Modified: 2017-06-28 22:17 UTC
From: jerry at jmweb dot net Assigned:
Status: Wont fix Package: opcache
PHP Version: 7.1.6 OS: Windows 7 64bit
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jerry at jmweb dot net
New email:
PHP Version: OS:


 [2017-06-26 17:02 UTC] jerry at jmweb dot net
opcache.file_cache should not require drive lettered paths.

There are several ini path options that do not require drive letter prefixes in their values. The few that I am aware of include:


The impementation of each of the settings above are 'smart' enough to default to the drive which the PHP binary is running. This flexibility is appreciated when managing identical PHP installs across Windows and Linux as it minimizes the number of exclusive ini options (in separate files) required to maintain both.

Test script:

Expected result:
Opcache should not fail and default to C:/WAMP/php/ini in Windows or /WAMP/php/ini in Linux. The drive letter (in Windows) should default to the drive the PHP binary is currently running in.

Actual result:
Fatal Error opcache.file_cache_only is set without a proper setting of opcache.file_cache


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-26 17:44 UTC] spam2 at rhsoft dot net
"default to the drive which the PHP binary is running" is a adventurous conclusion just because *normally* relative paths are not defaulting to drives *but* to the current working directory and that is a dangerous thing for systemdwide paths

"managing identical PHP installs across Windows and Linux" should be done with don#t put anything system specific at all in php.ini - that's what "--with-config-file-scan-dir=" is all about and that options belong in a include file there

what you are asking is a dirty workaround for bad systems management - see the paragraph above
 [2017-06-26 22:23 UTC] jerry at jmweb dot net
Thanks for your response!

In my Linux builds, I do use '--with-config-file-scan-dir=' and, in Windows, I 'set PHP_INI_SCAN_DIR'. The point I was attempting to make is that opcache.file_cache should behave the same as the other ini path options when drive letterless paths are supplied.

I have no knowledge of PHP's internal workings so 'defaulting to the drive PHP is running' was merely an assumption aimed at illustrating how those options behave when such values are given. The benefit of my request would mean one less option in environment specific ini files as they all could share the value in my global (included by all) php.ini file.
 [2017-06-28 22:17 UTC]
-Status: Open +Status: Wont fix
 [2017-06-28 22:17 UTC]
Thanks for the report.

In general - the drive relative path can be used, of course, but there is simply no way to make it work for any configuration like you approach. NTFS supports multiple drive roots, so that's not about PHP.

It is correct, that several options use pure stream. In Opcache, the decision is to rely on the absolute path. To know the drive, one needs to know CWD. For NTS PHP uses the C runtime implementation, for TS there's own layer to handle it. Fe if talking about Apache on Windows - it usually does chdir() into its own root dir, and that's what matters for PHP as module or for any other Apache module. Given PHP and Apache would live on different drives, here you are. Very different behavior is to observe with mpm_prefork, FCGI or not Windows supported FPM.

There is simply no way to achieve the goal you strive. Even abstracted from Windows and thread safety, PHP is not in control what dependencies do. As such, I'd really recommend to leave the approach aside and rely on established facts. Relying on *drive* relative paths brings troubles of any sort, hard to catch and easy to avoid.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Mar 24 01:03:41 2023 UTC