日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > php >内容正文

php

nginx+php-fpm 的配置下,php的错误日志

發(fā)布時間:2025/5/22 php 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nginx+php-fpm 的配置下,php的错误日志 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

發(fā)現(xiàn)php 運(yùn)行錯誤時,瀏覽器的網(wǎng)頁上并沒有輸出php的錯誤日志。那php的錯誤日志在哪里呢? 發(fā)現(xiàn)在 /var/log/nginx/error.log文件中。

?

怎么樣才能在瀏覽器的網(wǎng)頁中輸出php的出錯信息呢?

編輯 /etc/php5/fpm/php.ini文件,將display_errors = On. (如果不改php.ini文件,只是在執(zhí)行文件中 ini_set("display_errors", "on"))發(fā)現(xiàn)沒效果,不知道為什么呢?奇怪!!

這樣改了php.ini文件后,網(wǎng)頁上就可以看到php的出錯信息了,便于調(diào)試。

-------------------------------------------------------------------------------------------------

?

?

8down vote

I gathered insights from a bunch of answers here and I present a comprehensive solution:

So, if you setup nginx with php5-fpm and log a message using?error_log()?you can see it in?/var/log/nginx/error.log?by default.

A problem can arise if you want to log a lot of data (say an array) using?error_log(print_r($myArr, true));. If an array is large enough, it seems that?nginx?will truncate your log entry.

To get around this you can configure?fpm?to manage logs. Here are the steps to do so.

  • Open?/etc/php5/fpm/pool.d/www.conf:

    $ sudo nano /etc/php5/fpm/pool.d/www.conf

  • Uncomment the following two lines by removing?;?at the beginning of the line:

    ;php_admin_value[error_log] = /var/log/fpm-php.www.log ;php_admin_flag[log_errors] = on

  • Create?/var/log/fpm-php.www.log:

    $ sudo touch /var/log/fpm-php.www.log;

  • Change ownership of?/var/log/fpm-php.www.log?so that php5-fpm can edit it:

    $ sudo chown vagrant /var/log/fpm-php.www.log

    Note:?vagrant?is the user that I need to give ownership to. You can see what user this should be for you by running?$ ps aux | grep php.*www?and looking at first column.

  • Restart php5-fpm:

    $ sudo service php5-fpm restart

  • Now your logs will be in?/var/log/fpm-php.www.log.

    轉(zhuǎn)載于:https://www.cnblogs.com/oxspirt/p/6219186.html

    《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀

    總結(jié)

    以上是生活随笔為你收集整理的nginx+php-fpm 的配置下,php的错误日志的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。