每次使用phpstorm上傳代碼后,寶塔的CPU占用就達到了100,有沒有解決方案。
使用phpstorm 的remote host 綁定服務(wù)器后,上傳的代碼,每次上傳完,寶塔顯示的CPU就爆滿了,不知道哪里配置有問題,有沒有大佬可以解決。 如下截圖是寶塔的CPU顯示。
新增查看進程占用比
開了debug模式導致文件更新會自動重啟吧
應(yīng)該是phpstorm一個一個文件上傳的過程中,monitor 進程檢測到文件有更新,不斷的reload進程導致的。
設(shè)置線上 config/process.php
里 monitor.constructor.options.enable_file_monitor
設(shè)置為false就好了。
或者不使用寶塔的守護進程,啟動的時候加 -d
會自動關(guān)閉文件更新檢測
服務(wù)啟動執(zhí)行的是 php start.php -d ; option 設(shè)置的內(nèi)容是這樣子;
'options' => [
'enable_file_monitor' => !Worker::$daemonize && DIRECTORY_SEPARATOR === '/',
'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
],
;如果設(shè)置false了,那上傳的代碼是不是不能立即生效?
return [
// File update detection and automatic reload
'monitor' => [
'handler' => process\Monitor::class,
'reloadable' => false,
'constructor' => [
// Monitor these directories
'monitor_dir' => [
app_path(),
config_path(),
base_path() . '/process',
base_path() . '/support',
base_path() . '/resource',
base_path() . '/.env',
],
// Files with these suffixes will be monitored
'monitor_extensions' => [
'php', 'html', 'htm', 'env'
]
]
]
];
老大,為什么我的 config/process.php
里面沒有monitor.constructor.options.enable_file_monitor
選項呢?