下面从系统层面、PHPStorm 设置、PHP 运行环境、硬件/使用习惯几个维度,给你一套比较实用的 Ubuntu 下 PHPStorm 优化方案。
sudo apt install gnome-tweaks
PHPStorm 依赖 inotify:
cat /proc/sys/fs/inotify/max_user_watches
如过小:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
编辑:
~/.config/JetBrains/PhpStorm*/phpstorm64.vmoptions
示例(16G 内存):
-Xms1024m
-Xmx4096m
-XX:ReservedCodeCacheSize=1024m
-XX:+UseG1GC
重启 PHPStorm 生效。
Settings → Plugins
建议关闭:
Settings → Appearance & Behavior → System Settings
Settings → Directories
标记为:
Excluded:
vendornode_modulesstoragecachelogsSettings → Editor → Inspections
Settings → Version Control → Git
/vendor
/node_modules
Settings → Editor → File Types
.log, .cacheFile → Invalidate Caches / Restart
sudo apt install php8.2 php8.2-cli
; /etc/php/8.2/cli/php.ini
opcache.enable=1
opcache.memory_consumption=256
php -S 快很多⚠ Xdebug 非常吃性能
建议:
xdebug.mode=debug
xdebug.start_with_request=no
rm -rf ~/.cache/JetBrains
✅ SSD
✅ vendor 排除
✅ JVM 4G
✅ 插件最小化
✅ Xdebug 按需
如果你愿意,可以告诉我:
我可以直接给你定制化配置。