|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-07-20 22:53 UTC] petk@php.net
Description: ------------ This bug has been encountered when fixing failed tests at https://github.com/php/php-src/pull/4392 There in 3 tests is sleep(2) delay needed to fully work as expected. Might be useful to check one day if there is anything to be fixed here because nikic said it is the zend_resolve_path() functionality which bails out for protocol-like paths... Attempted to be fixed via https://github.com/php/php-src/pull/4432 So for now I'm only forwarding the issue here. Thanks. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 08:00:01 2025 UTC |
`opcache_invalidate()` is a function in PHP used to invalidate a specific script in the OPCache, forcing it to be reloaded and recompiled on the next request. If you're facing issues where `opcache_invalidate()` doesn't seem to work as expected, here are some potential reasons and solutions: 1. Verify OPCache is Enabled and Configured Correctly: Ensure that OPCache is enabled in your PHP configuration (`php.ini`) and configured with the desired settings. 2. Check Permissions: Ensure that the user running PHP (e.g., Apache or PHP-FPM user) has the necessary permissions to invalidate the cache. 3. Check File Path: Double-check that you are providing the correct file path to `opcache_invalidate()`. The path should be absolute or relative to the server's file system. 4. Check File Changes: Confirm that the file you are attempting to invalidate has indeed been modified. OPCache will only reload the script if there have been changes. 5. Check for OPCache Restrictions: Be aware that OPCache may have restrictions or limitations set by configuration settings (e.g., `opcache.revalidate_freq`). Adjust these settings accordingly. 6. Restart PHP-FPM or Web Server: Sometimes, changes in OPCache may require restarting the PHP-FPM service or the web server to take effect. Here's an example of how you might use `opcache_invalidate()`: ```php <?php $fileToInvalidate = 'path/to/your/script.php'; if (file_exists($fileToInvalidate)) { opcache_invalidate($fileToInvalidate, true); echo 'Script invalidated successfully.'; } else { echo 'File not found or invalid path.'; } ?> ``` Ensure that you replace `'path/to/your/script.php'` with the actual path to the script you want to invalidate. If the issue persists, consider providing more details about your setup and how you are using `opcache_invalidate()`, so further assistance can be provided by https://github.com/pkarnadhar