最近在本地搭建的LNMP的开发环境。为了开发的时候不影响前端的正常开发就屏蔽的PHP里面php.ini中的一些错误提示。但是这样一来,就影响到了后端开发的一些问题比如不能及时调试开发中的一些问题。 nginx与apache不一样,在apache中可以直接指定php的错误日志
最近在本地搭建的LNMP的开发环境。为了开发的时候不影响前端的正常开发就屏蔽的PHP里面php.ini中的一些错误提示。但是这样一来,就影响到了后端开发的一些问题比如不能及时调试开发中的一些问题。
nginx与apache不一样,在apache中可以直接指定php的错误日志,那样在php执行中的错误信息就直接输入到php的错误日志中,可以方便查询。
在nginx中事情就变成了这样:nginx只对页面的访问做access记录日志。不会有php的error log 信息。nginx把对php的请求发给php-fpm fastcgi进程来处理,默认的php-fpm只会输出php-fpm的错误信息,在php-fpm的errors log里也看不到php的errorlog。
原因是php-fpm的配置文件php-fpm.conf中默认是关闭worker进程的错误输出,直接把他们重定向到/dev/null,所以我们在nginx的error log 和php-fpm的errorlog都看不到php的错误日志。
所以我们要进行如下的设置就能查看到nginx下php-fpm不记录php错误日志的方法:
1,修改php-fpm.conf中的配置,如果没有请增加:
?
001 002 003 004 005 |
|
2.修改php.ini中配置,没有则增加
?
001 002 003 |
|
3.重启php-fpm,
当PHP执行错误时就能看到错误日志在”/usr/local/lnmp/php/var/log/php_error_log”中了
如果出现:
?
001 002 003 004 005 006 |
|
那请在第一步的时候,认真将配置写入相对应的组中,不然就出现上面的:ERROR: [/usr/local/php/etc/php-fpm.conf:5] unknown entry ‘catch_workers_output’
最后看看效果:
?
?
http://www.pooy.net/nginx-open-php-fpm-error-log.html

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version
Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor