# Xampp性能調校指南 資料來源:https://odan.github.io/2017/02/05/xampp-how-to-enable-php-opcache.html 資料來源:https://www.cnblogs.com/fieldsman/p/speed-performance-of-xampps.html ## 查看apache mpm使用狀況 輸入httpd -l 確認模式為mpm_winnt.c ## 啟用opcache Open the file with Notepad++: c:\xampp\php\php.ini Add this line near the extension section: zend_extension=php_opcache.dll ## 設定httpd.conf EnableMMAP on EnableSendfile on Include conf/extra/httpd-mpm.conf ## 設定httpd-mpm.conf ``` <IfModule mpm_winnt_module> ThreadsPerChild 4000 ThreadLimit 350 MaxConnectionsPerChild 0 </IfModule> <IfModule !mpm_netware_module> MaxMemFree 4096 </IfModule> ``` ## 設定my.ini 在[mysqld]底下: query_cache_type=1 query_cache_size = 20M query_cache_limit=256K innodb_flush_log_at_trx_commit = 2 ## 設定php.ini [opcache] zend_extension=php_opcache.dll opcache.enable=1 opcache.enable_cli=1 # 共享内存大小 opcache.memory_consumption=1024 opcache.force_restart_timeout=3600 opcache.optimization_level=1 #interned string的内存大小, 也可调 opcache.interned_strings_buffer=8 #最大缓存的文件数目 opcache.max_accelerated_files=4096 #60s检查一次文件更新 opcache.revalidate_freq=60 #打开快速关闭, 打开这个在PHP Request Shutdown的时候, 回收内存的速度会提高 opcache.fast_shutdown=1 #不保存文件/函数的注释 opcache.save_comments=0