You are here: 首頁

飛朵啦學習手札

本網站建議使用Firefox2.0以上,或是使用Goole瀏覽器來瀏覽,並使用1024x768解析度來觀看.

JA slide show

新聞公告

歡迎來到飛朵啦學習手札

十二02

nginx 502 Bad Geteway 錯誤(php-fpm “stderr 未處理)

E-mail 列印 PDF

目前碰到一個很神奇的nginx 502 Bad Geteway錯誤問題。

出現錯誤的程式並不複雜,可以說只是跑一個大約30次的迴圈,而且不會是無窮迴圈,但在不同查詢條件下就會出現502的錯誤。

但為這在我測試電腦(apache)同一支程式,同樣條件,同樣的資料卻沒有出現502整頁掛掉的事情。

後來加上

ini_set('log_errors', 1);

ini_set('error_reporting', E_ALL);

ini_set('error_log', 'log/php_error.log');

程式便正常了,然後仔細一看錯誤訊息裡有許多的未定義,我修正未定義錯誤後,將error_log關掉,也正常了。

我將此問題丟到ChatGpt回應如下:

 

=======ChatGpt===============

 

你的直覺完全正確,而且你剛描述的狀況 正好踩到 Nginx + PHP-FPM 的一個很常見、但非常隱晦的「錯誤訊息 buffer」問題
這也是為什麼:

  • Apache (mod_php) 完全不會出問題

  • 同一支程式,在 Nginx 就會莫名其妙 502

  • 加上 error_log 後反而正常

你這次看到的狀況完全符合 php-fpm “stderr 未處理 + 大量錯誤訊息導致 worker 退出 / pipe broken” 這個經典問題。

下面我幫你把整個機制講清楚,你會完全理解為什麼會這樣(而且你以後遇到同型 502 都能瞬間定位)。

最近更新 ( 週二, 02 十二月 2025 09:53 )
 
 
02

解決XAMPP MYSQL 無法權限表損毀啟動問題

E-mail 列印 PDF

XAMPP 完全無法啟動,而且PORT沒有被佔用權限表損毀。

錯誤訊息:

上午 10:14:09  [mysql] Status change detected: stopped

上午 10:14:09  [mysql] Error: MySQL shutdown unexpectedly.

上午 10:14:09  [mysql] This may be due to a blocked port, missing dependencies,

上午 10:14:09  [mysql] improper privileges, a crash, or a shutdown by another method.

上午 10:14:09  [mysql] Press the Logs button to view error logs and check

上午 10:14:09  [mysql] the Windows Event Viewer for more clues

上午 10:14:09  [mysql] If you need more help, copy and post this

上午 10:14:09  [mysql] entire log window on the forums

 

解決辦法:

1.緊急模式啟動(修復權限表)MYSQL:

mysqld --defaults-file="D:/tools/xampp/mysql/bin/my.ini" --skip-grant-tables --console

2.新開一個命令提示符窗口,登錄 MySQL:

mysql -u root

3.執行修復命令:

USE mysql;

REPAIR TABLE db;

如果看到以下結果Msg_text 是 OK,代表修復成功!

+--------+----------+----------+----------+

| Table  | Op       | Msg_type | Msg_text |

+--------+----------+----------+----------+

| mysql.db | repair | status   | OK       |

+--------+----------+----------+----------+

 

相關網址:

https://chatgpt.com/c/68142bfc-2898-8001-8f3e-3d3ce5728083

https://chat.deepseek.com/a/chat/s/8e6ee391-79e6-463f-a28c-16d6051da98c

最近更新 ( 週五, 02 五月 2025 11:20 )
 
 
17

錯誤SQLSTATE[HY000]: General error: 1 no such table: sessions

E-mail 列印 PDF

在composer裝好後,別忘了 使用下列指令建立基本資料庫

php artisan migrate

該狀況再在Laravel11出現

最近更新 ( 週五, 02 五月 2025 11:21 )
 
第 1 頁, 共 52 頁