Mac 配置 php-fpm

來源:互聯網
上載者:User

標籤:mac   read   資訊   log   already   git   lan   ble   ice   

https://github.com/musicode/test/issues/5

 

Mac 內建 php-fpm,在終端執行 php-fpm,會報如下錯誤:

ERROR: failed to open configuration file ‘/private/etc/php-fpm.conf‘: No such file or directory (2)ERROR: failed to load configuration file ‘/private/etc/php-fpm.conf‘ERROR: FPM initialization failed

錯誤資訊顯示,不能開啟設定檔,cd /private/etc,發現沒有 php-fpm.conf 檔案,但是有 php-fpm.conf.default 檔案。這個檔案是預設配置,我們可以複製一份,改名為 php-fpm.conf,然後再根據需要改動配置。

cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf

執行 php-fpm,再次報錯:

ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2)ERROR: failed to post process the configurationERROR: FPM initialization failed

錯誤資訊顯示,不能開啟錯誤記錄檔檔案。cd /usr/var/log 發現根本沒有這個目錄,甚至連 var 目錄都沒有,加上為了避免許可權問題,乾脆配置到 /usr/local/var/log 目錄。

修改 php-fpm.conf error_log 配置為 /usr/local/var/log/php-fpm.log,並把 user 和 group 改為和目前使用者一樣。

執行 php-fpm,再次報錯:

NOTICE: [pool www] ‘user‘ directive is ignored when FPM is not running as rootNOTICE: [pool www] ‘group‘ directive is ignored when FPM is not running as root

於是 sudo php-fpm,再次報錯:

ERROR: unable to bind listening socket for address ‘127.0.0.1:9000‘: Address already in use (48)ERROR: FPM initialization failed

編輯 php-fpm.conf,修改 listen 為 127.0.0.1:9999。

執行 php-fpm -t,這個世界終於清淨了!

Mac 配置 php-fpm

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.