Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 65 lines (42 sloc) 1.663 kB
faba459 @ornicar Add README
ornicar authored
1 Provide a command line to clear APC cache from the console.
2
69ae912 @ornicar Add command, code template and DIC extension
ornicar authored
3 The problem with APC is that it's impossible to clear it from command line.
4 Because even if you enable APC for PHP CLI, it's a different instance than,
5 say, your Apache PHP or PHP-CGI APC instance.
6
7 The trick here is to create a file in the web dir, execute it through HTTP,
8 then remove it.
9
2449dae @ondrowan Added prerequisite to README.markdown. fixes #5
authored
10 Prerequisite
11 ============
12
13 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.
14
15
16
d42a1e0 @helmer Proper namespacing
helmer authored
17 Installation
18 ============
faba459 @ornicar Add README
ornicar authored
19
d42a1e0 @helmer Proper namespacing
helmer authored
20 1. Add this bundle to your project as a Git submodule:
faba459 @ornicar Add README
ornicar authored
21
d42a1e0 @helmer Proper namespacing
helmer authored
22 $ git submodule add git://github.com/ornicar/ApcBundle.git vendor/Bundles/Ornicar/ApcBundle
faba459 @ornicar Add README
ornicar authored
23
d42a1e0 @helmer Proper namespacing
helmer authored
24 2. Add `Ornicar` namespace to your autoloader:
faba459 @ornicar Add README
ornicar authored
25
d42a1e0 @helmer Proper namespacing
helmer authored
26 // app/autoload.php
27 $loader->registerNamespaces(array(
28 'Ornicar' => __DIR__.'/../vendor/bundles',
29 // your other namespaces
30 );
faba459 @ornicar Add README
ornicar authored
31
d42a1e0 @helmer Proper namespacing
helmer authored
32 3. Add this bundle to your application kernel:
faba459 @ornicar Add README
ornicar authored
33
d42a1e0 @helmer Proper namespacing
helmer authored
34 // app/AppKernel.php
35 public function registerBundles()
36 {
37 return array(
38 // ...
39 new Ornicar\ApcBundle\OrnicarApcBundle(),
40 // ...
41 );
42 }
faba459 @ornicar Add README
ornicar authored
43
d42a1e0 @helmer Proper namespacing
helmer authored
44 4. Configure `ornicar_apc` service:
faba459 @ornicar Add README
ornicar authored
45
d42a1e0 @helmer Proper namespacing
helmer authored
46 # app/config/config.yml
47 ornicar_apc:
48 host: http://example.com
49 web_dir: %kernel.root_dir%/../web
faba459 @ornicar Add README
ornicar authored
50
d42a1e0 @helmer Proper namespacing
helmer authored
51 Usage
52 =====
53
54 Clear all APC cache (opcode+user):
55
56 $ php app/console apc:clear
faba459 @ornicar Add README
ornicar authored
57
69ae912 @ornicar Add command, code template and DIC extension
ornicar authored
58 Clear only opcode cache:
faba459 @ornicar Add README
ornicar authored
59
d42a1e0 @helmer Proper namespacing
helmer authored
60 $ php app/console apc:clear --opcode
faba459 @ornicar Add README
ornicar authored
61
69ae912 @ornicar Add command, code template and DIC extension
ornicar authored
62 Clear only user cache:
faba459 @ornicar Add README
ornicar authored
63
d42a1e0 @helmer Proper namespacing
helmer authored
64 $ php app/console apc:clear --user
Something went wrong with that request. Please try again.