|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-06-10 15:18 UTC] alex at cgi-central dot net
Description:
------------
When option opcache.validate_permission is enabled, only first access to a file inside PHAR archive is succesfull.
All the following attempts to include or require a file from PHAR archive fail with error
--
Warning: include(): Failed opening 'phar:///var/www/html/33.phar/test.php' for inclusion
--
In same time, file_get_contents('phar:///var/www/html/33.phar/test.php') works fine as expected, so that is definitely an opcache issue. It happens even with "opcache.enable" is set to "off", so there is no quick workaround.
Test script:
---------------
There is a short test script:
https://github.com/alex-scott/php-phar-bug
Expected result:
----------------
The index.php file expected to output "OK" on each run.
Actual result:
--------------
Only first-run displays "OK", the following runs display error
Warning: include(): Failed opening 'phar:///var/www/html/33.phar/test.php' for inclusion
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 17 08:00:01 2025 UTC |
I've found a possible workaround, but anyway it is important to get this problem solved. If file is included like this Phar::loadPhar(__DIR__ . '/33.phar', 'phar33'); include 'phar://phar33/test.php'; instead of usual include ('phar://' . __DIR__ . '/33.phar/test.php'); Then it works without any issues.