Skip to content

opcache doesn't list all files with the same path when using chroot (opcache_get_status()) #18772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dugwood opened this issue Jun 5, 2025 · 0 comments

Comments

@dugwood
Copy link

dugwood commented Jun 5, 2025

Description

The following code:

<?php
echo '<pre>';
print_r(opcache_get_status());

Resulted in this output:

Array
(
    [...]
    [scripts] => Array
        (
            [/htdocs/temp.php] => Array
                (
                    [full_path] => /htdocs/temp.php
                    [...]
                )

But I expected this output instead:

Array
(
    [...]
    [scripts] => Array
        (
            [(chroot:/home/user1)/htdocs/temp.php] => Array
                (
                    [full_path] => /htdocs/temp.php
                    [...]
                )
            [(chroot:/home/user2)/htdocs/temp.php] => Array
                (
                    [full_path] => /htdocs/temp.php
                    [...]
                )

When using opcache.validate_root=1, same paths across different chroot are listed as one file only. There should be multiple keys.
Prefix is hashed using the inode number, which is working fine (so it's not a collision bug!):

ZCG(root_hash) = buf.st_ino;

Also the https://github.com/amnuts/opcache-gui/ doesn't work on invalidating those specific files. Don't know if it's related, but it's possible.

PHP Version

PHP 8.2.28 (cli) (built: Mar 13 2025 18:21:38) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.28, Copyright (c), by Zend Technologies

Operating System

Debian 12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants