问题描述
我尝试在符号链接样式部署后重置PHP opcache。在我的项目中有 opcache_reset.php
文件,它在文档根符号链接替换之后由 wget
执行
I am trying to reset PHP opcache after a symlink-style deployment. There is the opcache_reset.php
file in my project which is executing by wget
after the document root's symlink replacement:
<?php
clearstatcache(true);
opcache_reset();
尽管如此,旧文件仍然使用。根据 opcache_get_status()
输出, manual_restart
的数量增加, last_restart_time
保持最新,但文件路径仍然过时。我需要在部署完成一段时间之后手动调用 opcache_reset.php
。
In spite of that, the old files are still used. According to opcache_get_status()
output, the number of manual_restarts
increases, last_restart_time
keeps up-to-date, but the file paths remains outdated. I need to call opcache_reset.php
manually after a minute or so after deploy to make things right.
PHP版本是5.5.6,ZendOpcache是7.0.3-dev。
Opcache config:
PHP version is 5.5.6, ZendOpcache is 7.0.3-dev.Opcache config:
opcache.blacklist_filename => no value
opcache.consistency_checks => 0
opcache.dups_fix => Off
opcache.enable => On
opcache.enable_cli => On
opcache.enable_file_override => Off
opcache.error_log => no value
opcache.fast_shutdown => 1
opcache.force_restart_timeout => 180
opcache.inherited_hack => On
opcache.interned_strings_buffer => 8
opcache.load_comments => 1
opcache.log_verbosity_level => 1
opcache.max_accelerated_files => 4000
opcache.max_file_size => 0
opcache.max_wasted_percentage => 5
opcache.memory_consumption => 128
opcache.optimization_level => 0xFFFFFFFF
opcache.preferred_memory_model => no value
opcache.protect_memory => 0
opcache.restrict_api => no value
opcache.revalidate_freq => 60
opcache.revalidate_path => Off
opcache.save_comments => 1
opcache.use_cwd => On
opcache.validate_timestamps => On
推荐答案
。
我们通过在nginx配置中使用 $ realpath_root
来解决它:
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
这篇关于PHP opcache重置+符号链接样式部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!