Skip to content
Advertisement

How to precompile php opcache using command line?

I’m trying to warm up opcache via opcache.file_cache feature using console command.

My opcache.ini:

JavaScript

before I start my php-fpm process I compile files by executing scrpt from clommand line:

JavaScript

This script generates compiled files to specified (/tmp/.opcache) directory. Then I start php-fpm process, but no precompiled cache is not used and opcache compiles cache every time php-fpm process being restarted.

Is there a way to precompile opcache without using http requests?

Advertisement

Answer

May be someone will find this useful Precompiling opcache for php-fpm via CLI does work For some reason it takes too much time (compared with in-memory stored Opcodes) to load cached files into memory, but no recompilation of PHP files being executed.

P.S. This trick works even for different opcache confgurations.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement