note 123780 added to opcache.configuration
| From: | tizian dot schmidlin at gmail dot com | Date: | Mon, 15 Apr 2019 09:41:44 +0000 |
| Subject: | note 123780 added to opcache.configuration | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210603@lists.php.net to get a copy of this message | ||
It should be noted that according to the original RFC (https://wiki.php.net/rfc/preload)
opcache.preload caches preloaded files *forever* for all instances of the underlying
PHP process.
That means, that hosting multiple websites on the same server might result in some unexpected
behaviour.
Concrete example:
- you have a Symfony 3.2 App (which might be an endpoint of some type) and a Symfony 3.4 App (which
might be your main application)
- both apps have a main Class called App that is in the same namespace (as it is usual, since the
class name is unique to each project)
- depending on which app is loaded first, one or the other will work, since
opcache.preload has no file based distinction of what class is used where and simply
provides them to the user space
This is avoidable by simply not preloading user space classes or, if you work with FPM, by defining
a pool for each app.
In order to optimize memory consumption, you might also use a common FPM Pool for all Symfony 3.4
Apps and preload the entire framework in there and simply not preload user space classes (which
might be cached by opcache anyway but is slower, since it will be checked if the file has changed on
every request).
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.142 (proxied: 82.220.9.178)
----
Manual Page -- http://php.net/manual/en/opcache.configuration.php
Edit -- https://master.php.net/note/edit/123780
Del: integrated -- https://master.php.net/note/delete/123780/integrated
Del: useless -- https://master.php.net/note/delete/123780/useless
Del: bad code -- https://master.php.net/note/delete/123780/bad+code
Del: spam -- https://master.php.net/note/delete/123780/spam
Del: non-english -- https://master.php.net/note/delete/123780/non-english
Del: in docs -- https://master.php.net/note/delete/123780/in+docs
Del: other reasons-- https://master.php.net/note/delete/123780
Reject -- https://master.php.net/note/reject/123780
Search -- https://master.php.net/manage/user-notes.php