pthreads(四)php7隻支援在cli模式下使用pthreads擴充

來源:互聯網
上載者:User
1 ERROR!

用php7了,編譯之後安裝好擴充,運行php-fpm的時候報錯,在公司沒有解決,回家在mac上複現這個問題:

[24-Mar-2016 23:06:50] NOTICE: PHP message: PHP Fatal error: The fpm-fcgi SAPI is not supported by pthreads in Unknown on line 0
Fatal error: The fpm-fcgi SAPI is not supported by pthreads in Unknown on line 0

[24-Mar-2016 23:06:50] NOTICE: PHP message: PHP Fatal error: Unable to start pthreads module in Unknown on line 0
Fatal error: Unable to start pthreads module in Unknown on line 0

2 WHY?

一直以為這個問題是可能是因為php7不穩定導致的,後來看到百度上有人說php7隻允許CLI模式下使用pthreads擴充,對此半信半疑,好吧,上github看看:

pthreads v3 is restricted to operating in CLI only: I have spent many years trying to explain that threads in a web server just don't make sense, after 1,111 commits to pthreads I have realised that, my advice is going unheeded.

So I'm promoting the advice to hard and fast fact: you can't use pthreads safely and sensibly anywhere but CLI.

Thanks for listening ;)

以上是作者的原話

3 SOLVE:

CLI模式下,php會優先讀取php-cli.ini,如果沒找到會使用php.ini,SO:

【1】cp php.ini php-cli.ini // extension=/..(路徑)../pthreads.so

【2】編輯原來的php.ini檔案注釋掉pthreads擴充 // ;extension=/..(路徑)../pthreads.so

這樣CLI模式下php-cli.ini生效,而php-fpm不會讀php-cli.ini

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.