因爲公司開發部的須要,如今須要使用php-5.4.17,按照慣例下載、安裝、配置。可是在配置好了以後,屢次重啓php-fpm,發現php-fpm.log裏有不少下面的錯誤信息:php
[24-Aug-2013 04:29:05] ERROR: unable to read what child say: Bad file descriptor (9) [24-Aug-2013 04:29:05] ERROR: unable to read what child say: Bad file descriptor (9) [24-Aug-2013 04:29:05] ERROR: unable to read what child say: Bad file descriptor (9) [24-Aug-2013 04:29:05] ERROR: unable to read what child say: Bad file descriptor (9) [24-Aug-2013 04:29:05] ERROR: unable to read what child say: Bad file descriptor (9)
真是奇怪了,配置也沒有什麼特別的,都和老版本同樣啊!bash
配置文件內容以下:ide
[global] pid = run/php-fpm.pid error_log = log/php-fpm.log log_level = notice daemonize = yes rlimit_files = 65536 [www] user = daemon group = daemon listen = 127.0.0.1:9000 listen.allowed_clients = 127.0.0.1 pm = static pm.max_children = 128 pm.max_requests = 500 pm.status_path = /status ping.path = /ping ping.response = pong slowlog = var/log/$pool.log.slow request_slowlog_timeout = 2s request_terminate_timeout = 15s rlimit_files = 65536 catch_workers_output = yes php_flag[display_errors] = on
後來發現是catch_workers_output = yes形成的,把yes改爲no就行了,不報錯了。php-fpm
可是這個功能正是須要的,因此我想這應該是php-5.4.17的一個bug,最後不用這個版本了,用了php-5.3.27。google
編譯安裝方法同php-5.4.17相同,反覆重啓仍是出現和php-5.4.17相同的錯誤,真是見鬼了。.net
開始google吧,最後發現問題了,的確是個bug。ip
bug地址:https://bugs.php.net/bug.php?id=65398&edit=3開發
能夠看到存在這個bug的版本有3個,分別是:5.3.27, 5.4.17, 5.5.1。get
解決方法也就有了,bug頁下面提供了一個補丁,打上補丁就ok了,具體操做以下:requests
下載補丁文件:
wget -O fpm-race-condition.patch 'https://bugs.php.net/patch-display.php?bug_id=65398&patch=fpm-race-condition.patch&revision=1375772074&download=1'
打補丁:
patch -d php-5.3.27 -p0 < fpm-race-condition.patch
從新編譯、安裝。此次把catch_workers_output = yes開啓,再次反覆重啓再也不出現那個錯誤了。
ok,問題解決!