php.ini设置相关信息汇总
生活随笔
收集整理的這篇文章主要介紹了
php.ini设置相关信息汇总
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本條指令控制PHP是否輸出errors、notices、warnings。一般在開發模式下打開,在產品模式下關閉。
有點坑的是,php.ini中,文件開頭就又關于display_errors指令的介紹,但是,在后面才是設置。我第一次就是在開頭處設置了,但是在文件后面因為還存在display_errors真正設置的地方,導致后面的設置覆蓋了前面的設置,從而使我的設置一直無法生效???#xff01;坑!坑!
在爬坑過程中用到的幾個方法:
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)
; (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有關的函數,可能可以在輸出之后調用。當關閉本指令時,因為響應頭是向發出的,所以在這些函數之前,不能存在輸出。
?
轉載于:https://www.cnblogs.com/jade640/p/7117783.html
總結
以上是生活随笔為你收集整理的php.ini设置相关信息汇总的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 新零售 - 特征
- 下一篇: 动态规划算法php,php算法学习之动态