@@ -12,8 +12,6 @@ Symfony Application Checklist
12
12
-----------------------------
13
13
14
14
#. :ref: `Install APCu Polyfill if your server uses APC <performance-install-apcu-polyfill >`
15
- #. :ref: `Enable APC Caching for the Autoloader <performance-autoloader-apc-cache >`
16
- #. :ref: `Use Bootstrap Files <performance-use-bootstrap-files >`
17
15
18
16
Production Server Checklist
19
17
---------------------------
@@ -34,80 +32,6 @@ OPcache, install the `APCu Polyfill component`_ in your application to enable
34
32
compatibility with `APCu PHP functions `_ and unlock support for advanced Symfony
35
33
features, such as the APCu Cache adapter.
36
34
37
- .. _performance-autoloader-apc-cache :
38
-
39
- Enable APC Caching for the Autoloader
40
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41
-
42
- The class autoloading mechanism is one of the slowest parts in PHP applications
43
- that make use of lots of classes, such as Symfony. A simple way to improve its
44
- performance is to use the :class: `Symfony\\ Component\\ ClassLoader\\ ApcClassLoader `,
45
- which caches the location of each class after it's located the first time.
46
-
47
- To use it, adapt your front controller file like this::
48
-
49
- // app.php
50
- // ...
51
-
52
- $loader = require_once __DIR__.'/../app/bootstrap.php.cache';
53
-
54
- // Change 'sf' by something unique to this app to prevent
55
- // conflicts with other applications running in the same server
56
- $loader = new ApcClassLoader('sf', $loader);
57
- $loader->register(true);
58
-
59
- // ...
60
-
61
- For more details, see :doc: `/components/class_loader/cache_class_loader `.
62
-
63
- .. note ::
64
-
65
- When using the APC autoloader, if you add new classes, they will be found
66
- automatically and everything will work the same as before (i.e. no
67
- reason to "clear" the cache). However, if you change the location of a
68
- particular namespace or prefix, you'll need to flush your APC cache. Otherwise,
69
- the autoloader will still be looking at the old location for all classes
70
- inside that namespace.
71
-
72
- .. _performance-use-bootstrap-files :
73
-
74
- Use Bootstrap Files
75
- ~~~~~~~~~~~~~~~~~~~
76
-
77
- .. caution ::
78
-
79
- Thanks to the optimizations introduced in PHP 7, bootstrap files are no
80
- longer necessary when running your Symfony applications with PHP 7 or a
81
- newer PHP version.
82
-
83
- The Symfony Standard Edition includes a script to generate a so-called
84
- `bootstrap file `_, which is a large file containing the code of the most
85
- commonly used classes. This saves a lot of IO operations because Symfony no
86
- longer needs to look for and read those files.
87
-
88
- If you're using the Symfony Standard Edition, then you're probably already
89
- using the bootstrap file. To be sure, open your front controller (usually
90
- ``app.php ``) and check to make sure that the following line exists::
91
-
92
- require_once __DIR__.'/../app/bootstrap.php.cache';
93
-
94
- Note that there are two disadvantages when using a bootstrap file:
95
-
96
- * the file needs to be regenerated whenever any of the original sources change
97
- (i.e. when you update the Symfony source or vendor libraries);
98
-
99
- * when debugging, one will need to place break points inside the bootstrap file.
100
-
101
- If you're using the Symfony Standard Edition, the bootstrap file is automatically
102
- rebuilt after updating the vendor libraries via the ``composer install `` command.
103
-
104
- .. note ::
105
-
106
- Even when using a byte code cache, performance will improve when using a
107
- bootstrap file since there will be fewer files to monitor for changes. Of
108
- course, if this feature is disabled in the byte code cache (e.g.
109
- ``apc.stat=0 `` in APC), there is no longer a reason to use a bootstrap file.
110
-
111
35
.. _performance-use-opcache :
112
36
113
37
Use the OPcache Byte Code Cache
0 commit comments