
有一個腳本(在這裡找到),旨在監視日誌檔案:如果關鍵字觸發則執行命令:
journalctl -f | \
while read line ; do
echo "$line" | grep "apcu"
if [ $? = 0 ]
then
systemctl restart php7.2-fpm.service
fi
done
我使用以下幾行建立並啟用了 systemd 服務:
[Service]
ExecStart=/home/alex/journal-trigger.sh
StandardOutput=file:/home/alex/journal-trigger.log
StandardError=file:/home/alex/journal-trigger.error.log
這是一個臨時措施,當 apcu.so 模組失敗時會重新啟動 php 服務。然而,我面臨一個缺點(當命令包含“apcu”時):
sudo php cachetool.phar apcu:cache:info --fcgi
In FastCGI.php line 133:
FastCGI error: Stream got blocked, or terminated. (/var/run/php/php7.2-fpm.sock)
In Socket.php line 525:
Stream got blocked, or terminated.
我該如何修復它?
答案1
好的,我通過解決了這個問題,grep kernel\:\ traps\:.*apcu\.so
但真正的修復是在應用程式級別:apcu_clear_cache()
無意中留在了產品伺服器上的 PHP 程式碼中...