Download the PHP package sixdays/opcache-bundle without Composer
On this page you can find all versions of the php package sixdays/opcache-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sixdays/opcache-bundle
More information about sixdays/opcache-bundle
Files in sixdays/opcache-bundle
Package opcache-bundle
Short Description Provides a command line task to clear opcache cache from the console
License MIT
Homepage https://github.com/sixdayz/OpcacheBundle
Informations about the package opcache-bundle
Provide a command line to clear opcache cache from the console.
The problem with opcache is that it's impossible to clear it from command line. Because even if you enable opcache for PHP CLI, it's a different instance than, say, your Apache PHP or PHP-CGI opcache instance.
The trick here is to create a file in the web dir, execute it through HTTP, then remove it.
Installation
-
Add it to your composer.json:
or:
-
Add this bundle to your application kernel:
// app/AppKernel.php public function registerBundles() { return array( // ... new Sixdays\OpcacheBundle\SixdaysOpcacheBundle(), // ... ); }
-
Configure
sixdays_opcache
service:# app/config/config.yml sixdays_opcache: base_url: http://localhost/ #could also be https://, or http://127.0.0.1:8000/, or any other valid URL web_dir: %kernel.root_dir%/../web
Usage
Clear all opcache cache:
$ php app/console opcache:clear
Capifony usage
To automatically clear opcache cache after each capifony deploy you can define a custom task
and add this hook
Nginx configuration
If you are using nginx and limiting PHP scripts that you are passing to fpm you need to allow 'opcache' prefixed php files. Otherwise your web server will return the requested PHP file as text and the system won't be able to clear the opcache cache.
Example configuration: