php.ini设置相关信息汇总
生活随笔
收集整理的這篇文章主要介紹了
php.ini设置相关信息汇总
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
本條指令控制PHP是否輸出errors、notices、warnings。一般在開(kāi)發(fā)模式下打開(kāi),在產(chǎn)品模式下關(guān)閉。
有點(diǎn)坑的是,php.ini中,文件開(kāi)頭就又關(guān)于display_errors指令的介紹,但是,在后面才是設(shè)置。我第一次就是在開(kāi)頭處設(shè)置了,但是在文件后面因?yàn)檫€存在display_errors真正設(shè)置的地方,導(dǎo)致后面的設(shè)置覆蓋了前面的設(shè)置,從而使我的設(shè)置一直無(wú)法生效。坑!坑!坑!
在爬坑過(guò)程中用到的幾個(gè)方法:
1. ini_get()
2. php --ini??? 查看php加載的是哪個(gè)php.ini文件
3. php-fpm -t??? 通過(guò)php-fpm 測(cè)試配置文件指令查看php-fpm加載的php-fpm.conf文件路徑
4. phpinfo()
另外的一個(gè)總結(jié):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會(huì)
1. 首先從sapi的參數(shù)中查看是否指定了php.ini
2. 如果沒(méi)有就通過(guò)PHPRC環(huán)境變量指定的路徑查找
3. 如果沒(méi)有,或者PHPRC環(huán)境變量未設(shè)置,則從registry keys注冊(cè)表從找(專用于windows)
4. 從當(dāng)前的工作目錄中查找(除了CLI)
5. 從web服務(wù)器的目錄中查找(對(duì)于SAPI模塊),或者PHP的目錄中
6. 從php編譯時(shí)指定的--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.
由上可知,本條指令控制是否打開(kāi)輸出緩存。
注意,當(dāng)打開(kāi)輸出緩存時(shí),header()、session_start()等于response header有關(guān)的函數(shù),可能可以在輸出之后調(diào)用。當(dāng)關(guān)閉本指令時(shí),因?yàn)轫憫?yīng)頭是向發(fā)出的,所以在這些函數(shù)之前,不能存在輸出。
?
轉(zhuǎn)載于:https://www.cnblogs.com/jade640/p/7117783.html
總結(jié)
以上是生活随笔為你收集整理的php.ini设置相关信息汇总的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 新零售 - 特征
- 下一篇: java Enumset