我必须实现功能,这将通过终端重置opcache。
这是我当前的配置/etc/php/7.1/apache2/php.ini
[opcache]
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 12850
opcache.validate_timestamps = 1
opcache.revalidate_freq = 0
opcache.fast_shutdown = 1/etc/php/7.1/cli/php.ini
[opcache]
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 12850
opcache.validate_timestamps = 1
opcache.revalidate_freq = 0
opcache.fast_shutdown = 1我的问题是,当我运行一些shell脚本(它将执行类似于这个php脚本的东西)时,php -r "opcache_get_status();"会重置一些“全局”opcache,或者这只会重置cli opcache,您必须为apache实现其他一些东西。
如果您需要任何额外的信息,请让我知道,并将提供。谢谢!
发布于 2017-11-24 08:09:54
Op_cache (对于apache)需要通过url或curl请求重新处理。如果您通过cli运行php -r "opcache_reset();",那么情况就不一样了,这意味着Apache上的op_cache不会被重新设置。我的解决方案是/是创建简单的虚拟主机,它正在执行用于重新设置op_cache的小php脚本。
我的虚拟主机
<VirtualHost 127.0.0.1:80>
DocumentRoot /var/www/html/opcache
ServerName localhost
DirectoryIndex index.php
<Directory /var/www/html/opcache>
Options All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1
Allow from localhost
</Directory>
</VirtualHost>我的php脚本
<?php
opcache_reset();然后我通过终端用curl执行脚本。
curl -o -I -L -s -w "Response code %{http_code}\n" http://127.0.0.1/opcache/index.phphttps://stackoverflow.com/questions/47331419
复制相似问题