要在Debian上启用OPcache,您需要安装PHP的OPcache扩展并进行相关配置。以下是具体步骤:
sudo apt-get update
sudo apt-get install php-opcache
sudo nano /etc/php/7.4/apache2/php.ini
在php.ini文件中找到以下行并取消注释(删除前面的分号):
zend_extension=opcache.so
可以根据需要设置OPcache的其他配置项,如:
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
sudo systemctl restart apache2
现在OPcache已经启用并配置完成,您可以在PHP脚本中使用OPcache来提高性能。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:Debian PHP如何使用缓存技术