Req #74818 [Opn->Wfx]: opcache.file_cache should not require drive letter paths
| From: | ab@php.net | Date: | Wed, 28 Jun 2017 22:17:40 +0000 |
| Subject: | Req #74818 [Opn->Wfx]: opcache.file_cache should not require drive letter paths | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209717@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74818&edit=1
ID: 74818
Updated by: ab@php.net
Reported by: jerry at jmweb dot net
Summary: opcache.file_cache should not require drive letter
paths
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: opcache
Operating System: Windows 7 64bit
PHP Version: 7.1.6
Block user comment: N
Private report: N
New Comment:
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.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2017-06-26 22:23:10] 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-26 17:44:25] 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 17:02:26] jerry at jmweb dot net
Description:
------------
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:
error_log
extension_dir
sys_temp_dir
upload_tmp_dir
session.save_path
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:
---------------
opcache.file_cache=/WAMP/php/ini
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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74818&edit=1