Download the PHP package smart-core/accelerator-cache-bundle without Composer
On this page you can find all versions of the php package smart-core/accelerator-cache-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download smart-core/accelerator-cache-bundle
More information about smart-core/accelerator-cache-bundle
Files in smart-core/accelerator-cache-bundle
Package accelerator-cache-bundle
Short Description Provides a command line task to clear PHP Accelerators cache from the console
License MIT
Homepage https://github.com/Smart-Core/AcceleratorCacheBundle
Informations about the package accelerator-cache-bundle
Provide a command line to clear PHP Accelerator cache from the console.
The problem with Accelerator cache (like APC, Wincache, Opcache) is that it's impossible to clear it from command line. Because even if you enable APC for PHP CLI, it's a different instance than, say, your Apache PHP or PHP-CGI APC instance.
The trick here is to create a file in the web dir, execute it through HTTP, then remove it.
Prerequisite
If you want to clear Apache part of APC, you will need to enable allow_url_fopen
in php.ini
to allow opening of URL
object-like files, or set the curl option.
Installation
-
Add it to your composer.json:
or:
-
Add this bundle to your application kernel:
-
Configure
accelerator_cache
service: - If you want to use curl rather than fopen set the following option:
Usage
Clear all Accelerator cache (opcode+user):
$ php app/console cache:accelerator:clear
Clear only opcode cache:
$ php app/console cache:accelerator:clear --opcode
Clear only user cache:
$ php app/console cache:accelerator:clear --user
Clear the CLI cache (opcode+user):
$ php app/console cache:accelerator:clear --cli
Composer usage
To automatically clear accelerator cache after each composer install / composer update, you can add a script handler to your project's composer.json :
+You can specify command arguments in the extra
section:
-
--opcode
(to clean only opcode cache): -
--user
(to clean only user cache): -
--cli
(to only clear cache via the CLI): --auth
(HTTP authentification):
Capifony usage
To automatically clear apc cache after each capifony deploy you can define a custom task
and add these hooks
Nginx configuration
If you are using nginx and limiting PHP scripts that you are passing to fpm you need to allow 'apc' 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 accelerator cache.
Example configuration: