How to flush opcache?
题
According to there documentation i needed to use phpinfo() to check for inconsistencies in my php.ini.
I have put it in the index.php because all other files are not accessable from the web. Or give error's like:
Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/var/www/magento/var/page_cache" is not writable in /var/www/magento/vendor/magento/zendframework1/library/Zend/Cache.php:209
Is there a command like: magento cache:opcache:reset
?
解决方案
To clear PHP OPCache you can just restart PHP - systemctl restartphp7.0-fpm
(For Ubuntu 16.04)
You can also create an opcache_clear.php
file with the contents:
<?php
opcache_reset();
?>
As a side note, to get your phpinfo() to work correctly you need to create the file within the /path/to/magento/pub/
directory to be able to access it via browser, for example:
Create:
/path/to/magento/pub/info.php
Access:
https://example.com/info.php
其他提示
If you are on development environment Opcache timestamp validation should always be on to avoid refreshing cache when modifying files
opcache.validate_timestamps = On