note 123320 added to function.opcache-reset
| From: | erutan409 at hotmail dot com | Date: | Thu, 08 Nov 2018 16:57:51 +0000 |
| Subject: | note 123320 added to function.opcache-reset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209648@lists.php.net to get a copy of this message | ||
So, I thought I'd share something that might benefit those looking for a way to reset opcache
in CLI.
As an example in my case, I'm running a Laravel app with a router script with the built-in web
server for local development. I enabled opcache with the following run configuration:
/path/to/php.exe -d zend_extension=php_opcache.dll -d opcache.enable_cli=1 -d
opcache.memory_consumption=128 -d opcache.max_accelerated_files=10000 -d
opcache.validate_timestamps=0 -d opcache.save_comments=0 -t project_path/public/ server.php
This is basically what artisan serve is doing behind the scenes, anyway, except without the opcache
part.
I have some file watchers setup to detect changes and executes the following upon said change(s):
/path/to/php.exe -d zend_extension=php_opcache.dll -d opcache.enable_cli=1 -r
"opcache_reset();"
The key is ensuring that you're enabling opcache in CLI. I've been using this for some
time, so I can attest to this being a viable solution without needing to create a script to execute
somewhere in the document root, etc.
I'm only referring to Laravel as an example of why I chose to explore options for solving this
problem. This should translate to any scenario a developer would need to utilize opcache in their
project(s) while using the built-in web server.
----
Server IP: 209.126.17.76
Probable Submitter: 107.0.213.3
----
Manual Page -- http://php.net/manual/en/function.opcache-reset.php
Edit -- https://master.php.net/note/edit/123320
Del: integrated -- https://master.php.net/note/delete/123320/integrated
Del: useless -- https://master.php.net/note/delete/123320/useless
Del: bad code -- https://master.php.net/note/delete/123320/bad+code
Del: spam -- https://master.php.net/note/delete/123320/spam
Del: non-english -- https://master.php.net/note/delete/123320/non-english
Del: in docs -- https://master.php.net/note/delete/123320/in+docs
Del: other reasons-- https://master.php.net/note/delete/123320
Reject -- https://master.php.net/note/reject/123320
Search -- https://master.php.net/manage/user-notes.php