Illegal websites should not initiate any form of manual service requests to our staff. It is strictly prohibited to use honmau Media's technical support services and products to engage in any illegal activities. If discovered, no technical support will be provided.×
Current location:home> news > help and support

How to clear the opcache in linux server php

When debugging the server environment, if the website code is updated, it cannot take effect immediately. Opcache needs to wait for the cache update to take effect, which is inconvenient for debugging.

php.ini default configuration

opcache.validate_timestamps=1

opcache. validate_freq=3 //By default, changed files are verified every 3 seconds and the cache is updated

Solution:

1 Development environment:

Will be revised to read:

opcache.revalidate_freq=1 //You can change 3s to 1s. The changed files will be verified every 1s and the cache will be updated

2 Online environment:

opcache.validate_timestamps=0 //The online environment is not enabled by default. If it is not enabled, cache will always be used

There are two ways to opcache cache cleanup:

1 If there isBaotaIf you are, you can add a Shell script to the scheduled task and execute the task regularly. The following is the script content:

'linux服务器php如何清除opcache缓存'

<? php

opcache_reset();

?>

2>>Or you can just reboot.Web server.

© Website copyright and disclaimer

1.[honmau Media] independently owns the copyright of all materials on relevant pages of this website;

2. No one is allowed to copy it without the express written permission of [honmau Media];

3. The articles that do not indicate "honmau Media" on this website are all from the Internet and are only for everyone to learn and refer;

4. If there is any infringement/violation/irregularity, please contact customer service QQ or email to delete it, please understand;

5.[honmau Media] reserves the right to correct, modify and update this statement at any time.legal notice

Message Board
* Contact customer service for urgent issues
submitted
submission
Working days: 8:30 - 22:00 Online QQ

customer service

Company Introduction
top