Forum: NGINX Nginx not logging errors...

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
X3 S. (Guest)
on 2009-02-04 05:37
For some reason Nginx has stopped logging PHP errors. Access logs still
work fine, but any PHP errors are no longer logged. Any reason why this
would happen? Really stumped here... it was working fine a couple days
ago.

I'm running PHP as php-fpm, btw. Also I've tried changing the error_log
config dir, but no luck. Also tried restarting nginx + PHP.
Ilan B. (Guest)
on 2009-02-04 06:00
(Received via mailing list)
check your php.ini settings for php error log location and corresponding
settings.
X3 S. (Guest)
on 2009-02-04 06:35
Ilan B. wrote:
> check your php.ini settings for php error log location and corresponding
> settings.

Log_errors is on and related settings:

log_errors = On
error_log = /var/log/php/php.errors
ignore_repeated_errors = Off
ignore_repeated_source = Off
log_errors_max_len = 1024

tried setting log_errors_max_len to 0 but still nothing. Here is my
entire PHP.ini

http://pastebin.ca/1326877
Ilan B. (Guest)
on 2009-02-04 07:06
(Received via mailing list)
I don't see an immediate issue with it, but I just don't think that
Nginx is
the problem in terms of php errors.  What about permissions on the error
directory?
X3 S. (Guest)
on 2009-02-04 07:31
Ilan B. wrote:
> I don't see an immediate issue with it, but I just don't think that
> Nginx is
> the problem in terms of php errors.  What about permissions on the error
> directory?

The permissions are correct, I have both the access and error logs in
the same directory. The access logs are being written to so no problem
there.

Is there anything I should add to the FastCGI section in nginx.conf?

        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME
/srv/www/nginx/domain.com/http$fastcgi_script_name;
            include        fastcgi_params;
        }
X3 S. (Guest)
on 2009-02-04 09:00
X3 Sphere wrote:
> Ilan B. wrote:
>> I don't see an immediate issue with it, but I just don't think that
>> Nginx is
>> the problem in terms of php errors.  What about permissions on the error
>> directory?
>
> The permissions are correct, I have both the access and error logs in
> the same directory. The access logs are being written to so no problem
> there.
>
> Is there anything I should add to the FastCGI section in nginx.conf?
>
>         location ~ \.php$ {
>             fastcgi_pass   127.0.0.1:9000;
>             fastcgi_index  index.php;
>             fastcgi_param  SCRIPT_FILENAME
> /srv/www/nginx/domain.com/http$fastcgi_script_name;
>             include        fastcgi_params;
>         }

A follow-up to this.. the permissions were set incorrectly on my
php.errors file, it now logs fine.

However.. all the errors used to show up in the nginx logs (useful as I
was able to log errors on a per domain basis). I'm not sure why this
behavior changed.
Igor S. (Guest)
on 2009-02-04 09:25
(Received via mailing list)
On Wed, Feb 04, 2009 at 08:00:47AM +0100, X3 Sphere wrote:

> >
> A follow-up to this.. the permissions were set incorrectly on my
> php.errors file, it now logs fine.
>
> However.. all the errors used to show up in the nginx logs (useful as I
> was able to log errors on a per domain basis). I'm not sure why this
> behavior changed.

What type do you mean ? In general nginx simply can not show php errors
as they are in independent process.
X3 S. (Guest)
on 2009-02-04 17:36
Igor S. wrote:
> On Wed, Feb 04, 2009 at 08:00:47AM +0100, X3 Sphere wrote:
>
>> >
>> A follow-up to this.. the permissions were set incorrectly on my
>> php.errors file, it now logs fine.
>>
>> However.. all the errors used to show up in the nginx logs (useful as I
>> was able to log errors on a per domain basis). I'm not sure why this
>> behavior changed.
>
> What type do you mean ? In general nginx simply can not show php errors
> as they are in independent process.

Errors were showing up in the nginx logs, like this:

2009/02/01 09:49:22 [error] 22004#0: *466 FastCGI sent in stderr: "PHP
Notice:  Undefined variable: template in
/srv/www/nginx/domain.com/daos/system/index.php on line 45

Also, general http errors are not being written either. Before, if I
tried to access a directory that did not exist, it would show in the
error log. But it no long does this.

2009/02/01 11:13:35 [error] 22004#0: *13333 open()
"/srv/www/nginx/domain.com/http/forums/test" failed (2: No such file or
directory), client: 70.176.235.197, server: forums.domain.com, request:
"GET /test HTTP/1.1", host: "forums.domain.com"

I'm having a hard time figuring out why it stopped as I haven't changed
the config since then, aside from adding a couple more vhosts.
X3 S. (Guest)
on 2009-02-04 19:32
After a lot of testing I have fixed this. The problem was that I did not
specify the error value after the path name.

error_log  /logs/nginx/domain.com/domain_error.log error;

However, it was working fine before this without "error" being
specified. Doesn't matter though, I'm just glad I finally found the
problem.
Igor S. (Guest)
on 2009-02-04 22:05
(Received via mailing list)
On Wed, Feb 04, 2009 at 06:32:53PM +0100, X3 Sphere wrote:

> After a lot of testing I have fixed this. The problem was that I did not
> specify the error value after the path name.
>
> error_log  /logs/nginx/domain.com/domain_error.log error;
>
> However, it was working fine before this without "error" being
> specified. Doesn't matter though, I'm just glad I finally found the
> problem.

What version do you use ?

There was bug (fixed in 0.7.31-0.7.32) when error_log without logging
level defined in http/server/location blocks did not log at all.
This topic is locked and can not be replied to.