欧美一区2区三区4区公司二百,国产精品婷婷午夜在线观看,自拍偷拍亚洲精品,国产美女诱惑一区二区

歡迎來到云服務(wù)器

服務(wù)器租用

nginx php-fpm 情況下如何生存php的錯誤日志

步調(diào)按下面的參考鏈接即可。

留意一點(diǎn):

; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
; in a local file.
; Note: the default prefix is /usr/local/var
; Default Value: log/php-fpm.log
error_log = log/php-fpm.log
//這里設(shè)置的文件的擁有者必然要和下面的設(shè)置的用戶一樣,不然大概呈現(xiàn)沒有權(quán)限,
//無法寫入文件,會導(dǎo)致日志無法呈現(xiàn)。
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = staff
group = staff

參考:

原文地點(diǎn):http://www.nginx.cn/666.html

nginx是一個web處事器,因此nginx的access日志只有對會見頁面的記錄,不會有php 的 error log信息。

nginx把對php的請求發(fā)給php-fpm fastcgi歷程來處理懲罰,默認(rèn)的php-fpm只會輸出php-fpm的錯誤信息,在php-fpm的errors log里也看不到php的errorlog

原因是php-fpm的設(shè)置文件php-fpm.conf中默認(rèn)是封鎖worker歷程的錯誤輸出,直接把他們重定向到/dev/null,所以我們在nginx的error log 和php-fpm的errorlog都看不到php的錯誤日志。

調(diào)試起來就很疾苦了。辦理nginx下php-fpm不記錄php錯誤日志的步伐:

1.修改php-fpm.conf中設(shè)置 沒有則增加
catch_workers_output = yes
error_log = log/error_log

2.修改php.ini中設(shè)置,沒有則增加
log_errors = On
error_log = "/usr/local/lnmp/php/var/log/error_log"
error_reporting=E_ALL&~E_NOTICE

3.重啟php-fpm,
當(dāng)PHP執(zhí)行錯誤時就能看到錯誤日志在"/usr/local/lnmp/php/var/log/error_log"中了

請留意:

1. php-fpm.conf 中的php_admin_value[error_log] 參數(shù) 會包圍php.ini中的 error_log 參數(shù)
所以確保你在phpinfo()中看到的最終error_log文件具有可寫權(quán)限而且沒有配置php_admin_value[error_log] 參數(shù),不然錯誤日志會輸出到php-fpm的錯誤日志里。
nginx php-fpm 情況下如何生存php的錯誤日志

2.找不到php.ini位置,利用php的phpinfo()功效查察
nginx php-fpm 情況下如何生存php的錯誤日志

3.如何修改PHP錯誤日志不輸出到頁面或屏幕上
修改php.ini
display_errors = off //不顯示錯誤信息(不輸出到頁面或屏幕上)
log_errors = on //記錄錯誤信息(生存到日志文件中)
error_reporting = E_ALL //捕捉所有錯誤信息
error_log = //配置日志文件名

措施中修改以上設(shè)置
ini_set("display_errors",0)
ini_set("error_reporting",E_ALL); //這個值仿佛是個PHP的常量
ini_set("error_log","<日志文件名>")
ini_set("log_errors",1);

4.如何將php的錯誤日志輸出到nginx的錯誤日志里
在PHP 5.3.8及之前的版本中,通過FastCGI運(yùn)行的PHP,在用戶會見時呈現(xiàn)錯誤,會首先寫入到PHP的errorlog中
假如PHP的errorlog無法寫入,則會將錯誤內(nèi)容返回給FastCGI接口,然后nginx在收到FastCGI的錯誤返回跋文錄到了nginx的errorlog中
在PHP 5.3.9及之后的版本中,呈現(xiàn)錯誤后PHP只實(shí)驗(yàn)寫入PHP的errorlog中,,假如失敗則不會再返回到FastCGI了,錯誤日志會輸出到php-fpm的錯誤日志里。
所以假如想把php錯誤日志輸出到nginx錯誤日志,需要利用php5.3.8之前的版本,而且設(shè)置文件中php的error_log對付php worker歷程不行寫

騰訊云代理

Copyright © 2003-2021 MFISP.COM. 國外vps服務(wù)器租用 夢飛云服務(wù)器租用 版權(quán)所有 ? 粵ICP備11019662號

主站蜘蛛池模板: 泾川县| 平谷区| 敦煌市| 华宁县| 穆棱市| 视频| 克拉玛依市| 武宣县| 凤城市| 定西市| 焦作市| 利川市| 喀什市| 临洮县| 巴彦淖尔市| 承德市| 正蓝旗| 开阳县| 花莲县| 牙克石市| 浦县| 长顺县| 石渠县| 图木舒克市| 天台县| 万安县| 苏尼特右旗| 龙山县| 广安市| 登封市| 红河县| 保靖县| 康平县| 达日县| 华池县| 呼伦贝尔市| 定远县| 南溪县| 阿克陶县| 巴塘县| 永仁县|