Nginx or php-fpm code file cache
伊谢尔伦
伊谢尔伦 2017-05-16 17:14:57
0
3
846

Problems I encountered:

Nginx configurationAThe root directory of the project isa, and theadirectory is soft linked toa1.
Later, after new code is released,a2at the same level asa1will be generated. The a directory also points toa2, but when accessingA# During the ## project, the code running result ofa1is still running. In theory, the codea2should be executed at this time.Even after deleting the
a1directory, the error message is still that some part of the code in thea1directory is incorrect.

I suspect it’s

Nginxorphp-fpmcaching the code files?
OPCache, orNginx, is there a configuration problem withphp-fpm?Please ask God for answers.

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all (3)
洪涛

Based on your description, I guess the problem lies in the fact that theopcache上。
这里nginx应该是把目录a作为路径传递到了php-fpm中(通常的配置是这样的),
opcache也是以路径作为缓存代码的Key,
所以说虽然软连接指向的目录改变了,但是opcacherecognized directories are the same, so the directly cached files are used.

It is recommended not to turn on code caching in the development environment, because currentlyopcacheit is not possible to check whether the file is updated every time. It can only be updated through functions or configuring the update time.

    仅有的幸福

    mtjpmj

      大家讲道理

      Configuration in php.ini:

      opcache.validate_timestamps=1 opcache.revalidate_freq=0

      opcache will verify the modification timestamp of the PHP file every time. If the PHP file has been modified, opcache will re-cache the new PHP file opcode into the memory.

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!