php.ini設定相關資訊匯總

來源:互聯網
上載者:User

標籤:ready   stream   ber   參數   session   web服務   arch   cookies   tput   

  1. display_errors
    本條指令控制PHP是否輸出errors、notices、warnings。一般在開發模式下開啟,在產品模式下關閉。
    有點坑的是,php.ini中,檔案開頭就又關於display_errors指令的介紹,但是,在後面才是設定。我第一次就是在開頭處設定了,但是在檔案後面因為還存在display_errors真正設定的地方,導致後面的設定覆蓋了前面的設定,從而使我的設定一直無法生效。坑!坑!坑!
    在爬坑過程中用到的幾個方法:
    1. ini_get()
    2. php --ini    查看php載入的是哪個php.ini檔案
    3. php-fpm -t    通過php-fpm 測試組態檔案指令查看php-fpm載入的php-fpm.conf檔案路徑
    4. phpinfo()

    另外的一個總結:php.ini的載入邏輯:
    ; PHP attempts to find and load this configuration from a number of locations.
    ; The following is a summary of its search order:
    ; 1. SAPI module specific location.
    ; 2. The PHPRC environment variable. (As of PHP 5.2.0)
    ; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0)
    ; 4. Current working directory (except CLI)
    ; 5. The web server‘s directory (for SAPI modules), or directory of PHP
    ; (otherwise in Windows)
    ; 6. The directory from the --with-config-file-path compile time option, or the
    ; Windows directory (C:\windows or C:\winnt)
    由上可知,php會
    1. 首先從sapi的參數中查看是否指定了php.ini
    2. 如果沒有就通過PHPRC環境變數指定的路徑尋找
    3. 如果沒有,或者PHPRC環境變數未設定,則從registry keys註冊表從找(專用於windows)
    4. 從當前的工作目錄中尋找(除了CLI)
    5. 從web伺服器的目錄中尋找(對於SAPI模組),或者PHP的目錄中
    6. 從php編譯時間指定的--with-config-file-path中尋找,或者在windows directory(C:\windows or C:\winnt)
  2. output_buffering
    ; Output buffering is a mechanism for controlling how much output data
    ; (excluding headers and cookies) PHP should keep internally before pushing that
    ; data to the client. If your application‘s output exceeds this setting, PHP
    ; will send that data in chunks of roughly the size you specify.
    ; Turning on this setting and managing its maximum buffer size can yield some
    ; interesting side-effects depending on your application and web server.
    ; You may be able to send headers and cookies after you‘ve already sent output
    ; through print or echo. You also may see performance benefits if your server is
    ; emitting less packets due to buffered output versus PHP streaming the output
    ; as it gets it. On production servers, 4096 bytes is a good setting for performance
    ; reasons.
    ; Note: Output buffering can also be controlled via Output Buffering Control functions.
    由上可知,本條指令控制是否開啟輸出緩衝。
    注意,當開啟輸出緩衝時,header()、session_start()等於response header有關的函數,可能可以在輸出之後調用。當關閉本指令時,因為回應標頭是向發出的,所以在這些函數之前,不能存在輸出。
  3. ?

 

php.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.