Welcome! Log In Create A New Profile

Advanced

PHP-FPM Apache error_log

Posted by cody 
cody
PHP-FPM Apache error_log
May 20, 2012 10:56PM
Hello,

We have our PHP-FPM deployment up and running and everything is
working great, however the Apache error_log is lacking some big items
we need and I cannot find anyway to get that info. We would like to
see the REMOTE_IP in the logs, but I cannot find a way to do so...

FPM.conf:

php_admin_value[error_log] = /usr/local/apache/logs/error_log
php_admin_flag[log_errors] = on
php_admin_value[error_reporting] = E_ALL

Apache error_log:

Here is what I see when a PHP error happens... for some reason its
using UTC timezone as well.

[20-May-2012 21:09:05 UTC] foo bar

At minimum I would like to have REMOTE_IP passed to the log... any
ideas?

Thanks,
Cody
Sammie S. Taunton
Re: PHP-FPM Apache error_log
May 21, 2012 10:36AM
Hello,

Are you using the latest version of PHP-FPM? There are new access log
options which allows you to set %R to get the Remote IP Address.

~ Sammie

On Sun, May 20, 2012 at 9:34 PM, cody <cbrugh@gmail.com> wrote:

> Hello,
>
> We have our PHP-FPM deployment up and running and everything is
> working great, however the Apache error_log is lacking some big items
> we need and I cannot find anyway to get that info. We would like to
> see the REMOTE_IP in the logs, but I cannot find a way to do so...
>
> FPM.conf:
>
> php_admin_value[error_log] = /usr/local/apache/logs/error_log
> php_admin_flag[log_errors] = on
> php_admin_value[error_reporting] = E_ALL
>
> Apache error_log:
>
> Here is what I see when a PHP error happens... for some reason its
> using UTC timezone as well.
>
> [20-May-2012 21:09:05 UTC] foo bar
>
> At minimum I would like to have REMOTE_IP passed to the log... any
> ideas?
>
> Thanks,
> Cody
cody
Re: PHP-FPM Apache error_log
May 21, 2012 11:48AM
Hi,

Yes, we are running php 5.3.13 with the --enable-fpm flag so I think I
am running the latest version.

I do see the %R for the access_log stuff, but does that same thing
work for error_log?

Thanks,
Cody

On May 21, 10:34 am, "Sammie S. Taunton" <diem...@gmail.com> wrote:
> Hello,
>
> Are you using the latest version of PHP-FPM? There are new access log
> options which allows you to set %R to get the Remote IP Address.
>
> ~ Sammie
>
>
>
>
>
>
>
> On Sun, May 20, 2012 at 9:34 PM, cody <cbr...@gmail.com> wrote:
> > Hello,
>
> > We have our PHP-FPM deployment up and running and everything is
> > working great, however the Apache error_log is lacking some big items
> > we need and I cannot find anyway to get that info.  We would like to
> > see the REMOTE_IP in the logs, but I cannot find a way to do so...
>
> > FPM.conf:
>
> > php_admin_value[error_log] = /usr/local/apache/logs/error_log
> > php_admin_flag[log_errors] = on
> > php_admin_value[error_reporting] = E_ALL
>
> > Apache error_log:
>
> > Here is what I see when a PHP error happens... for some reason its
> > using UTC timezone as well.
>
> > [20-May-2012 21:09:05 UTC] foo bar
>
> > At minimum I would like to have REMOTE_IP passed to the log... any
> > ideas?
>
> > Thanks,
> > Cody
cody
Re: PHP-FPM Apache error_log
May 21, 2012 09:26PM
I have some more info...

I changed FPM from socket to 127.0.0.1:9000 and setup the access_log
to log %R

127.0.0.1 - 21/May/2012:21:20:50

So what I see is the connection is from the localhost address instead
of the actual remote IP. This is likely due to my apache config line:

FastCGIExternalServer /php -host 127.0.0.1:9000 -idle-timeout 1000

Is there a way to pass the remote_IP so it doesn't do this?

Thanks


On May 21, 11:46 am, cody <cbr...@gmail.com> wrote:
> Hi,
>
> Yes, we are running php 5.3.13 with the --enable-fpm flag so I think I
> am running the latest version.
>
> I do see the %R for the access_log stuff, but does that same thing
> work for error_log?
>
> Thanks,
> Cody
>
> On May 21, 10:34 am, "Sammie S. Taunton" <diem...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > Are you using the latest version of PHP-FPM? There are new access log
> > options which allows you to set %R to get the Remote IP Address.
>
> > ~ Sammie
>
> > On Sun, May 20, 2012 at 9:34 PM, cody <cbr...@gmail.com> wrote:
> > > Hello,
>
> > > We have our PHP-FPM deployment up and running and everything is
> > > working great, however the Apache error_log is lacking some big items
> > > we need and I cannot find anyway to get that info.  We would like to
> > > see the REMOTE_IP in the logs, but I cannot find a way to do so...
>
> > > FPM.conf:
>
> > > php_admin_value[error_log] = /usr/local/apache/logs/error_log
> > > php_admin_flag[log_errors] = on
> > > php_admin_value[error_reporting] = E_ALL
>
> > > Apache error_log:
>
> > > Here is what I see when a PHP error happens... for some reason its
> > > using UTC timezone as well.
>
> > > [20-May-2012 21:09:05 UTC] foo bar
>
> > > At minimum I would like to have REMOTE_IP passed to the log... any
> > > ideas?
>
> > > Thanks,
> > > Cody
Przemysław Pawliczuk
RE: PHP-FPM Apache error_log
May 22, 2012 07:36AM
I think you should replicate additional environment variable with real IP using SetEnv. It's likely normal that PHP shows IP address from asker.

-----Original Message-----
From: highload-php-en@googlegroups.com [mailto:highload-php-en@googlegroups.com] On Behalf Of cody
Sent: Tuesday, May 22, 2012 3:25 AM
To: highload-php-en
Subject: Re: PHP-FPM Apache error_log

I have some more info...

I changed FPM from socket to 127.0.0.1:9000 and setup the access_log to log %R

127.0.0.1 - 21/May/2012:21:20:50

So what I see is the connection is from the localhost address instead of the actual remote IP. This is likely due to my apache config line:

FastCGIExternalServer /php -host 127.0.0.1:9000 -idle-timeout 1000

Is there a way to pass the remote_IP so it doesn't do this?

Thanks


On May 21, 11:46 am, cody <cbr...@gmail.com> wrote:
> Hi,
>
> Yes, we are running php 5.3.13 with the --enable-fpm flag so I think I
> am running the latest version.
>
> I do see the %R for the access_log stuff, but does that same thing
> work for error_log?
>
> Thanks,
> Cody
>
> On May 21, 10:34 am, "Sammie S. Taunton" <diem...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > Are you using the latest version of PHP-FPM? There are new access
> > log options which allows you to set %R to get the Remote IP Address.
>
> > ~ Sammie
>
> > On Sun, May 20, 2012 at 9:34 PM, cody <cbr...@gmail.com> wrote:
> > > Hello,
>
> > > We have our PHP-FPM deployment up and running and everything is
> > > working great, however the Apache error_log is lacking some big
> > > items we need and I cannot find anyway to get that info. We would
> > > like to see the REMOTE_IP in the logs, but I cannot find a way to do so...
>
> > > FPM.conf:
>
> > > php_admin_value[error_log] = /usr/local/apache/logs/error_log
> > > php_admin_flag[log_errors] = on php_admin_value[error_reporting] =
> > > E_ALL
>
> > > Apache error_log:
>
> > > Here is what I see when a PHP error happens... for some reason its
> > > using UTC timezone as well.
>
> > > [20-May-2012 21:09:05 UTC] foo bar
>
> > > At minimum I would like to have REMOTE_IP passed to the log... any
> > > ideas?
>
> > > Thanks,
> > > Cody
cody
Re: PHP-FPM Apache error_log
May 22, 2012 12:46PM
I just don't get why it doesn't log the remote IP in the
error_log.... Apache logs it fine and the old php-cgi method we used
to use worked fine.

Is there a way I could tell PHP-FPM to use syslog or something so my
logs will show up correctly?

Using php-fpm my error_log looks like:

[22-May-2012 14:43:06 UTC] PHP Fatal error:


Using php-cgi my error_log looked like:

[Tue May 22 07:35:44 2012] [error] [client 206.246.88.54] PHP Warning:


Notice the PHP-FPM uses UTC timezone (I have EST set in my php.ini)...
any ideas on how I can make PHP-FPM log like everything used to?

It should just work because php $_SERVER['REMOTE_ADDR'] returns the
correct remote IP when you use that in a PHP-FPM script.

Thanks

On May 22, 7:34 am, Przemysław Pawliczuk <p.pawlic...@gmail.com>
wrote:
> I think you should replicate additional environment variable with real IP using SetEnv. It's likely normal that PHP shows IP address from asker.
>
>
>
>
>
>
>
> -----Original Message-----
> From: highload-php-en@googlegroups.com [mailto:highload-php-en@googlegroups.com] On Behalf Of cody
> Sent: Tuesday, May 22, 2012 3:25 AM
> To: highload-php-en
> Subject: Re: PHP-FPM Apache error_log
>
> I have some more info...
>
> I changed FPM from socket to 127.0.0.1:9000 and setup the access_log to log %R
>
> 127.0.0.1 -  21/May/2012:21:20:50
>
> So what I see is the connection is from the localhost address instead of the actual remote IP.  This is likely due to my apache config line:
>
> FastCGIExternalServer /php -host 127.0.0.1:9000 -idle-timeout 1000
>
> Is there a way to pass the remote_IP so it doesn't do this?
>
> Thanks
>
> On May 21, 11:46 am, cody <cbr...@gmail.com> wrote:
> > Hi,
>
> > Yes, we are running php 5.3.13 with the --enable-fpm flag so I think I
> > am running the latest version.
>
> > I do see the %R for the access_log stuff, but does that same thing
> > work for error_log?
>
> > Thanks,
> > Cody
>
> > On May 21, 10:34 am, "Sammie S. Taunton" <diem...@gmail.com> wrote:
>
> > > Hello,
>
> > > Are you using the latest version of PHP-FPM? There are new access
> > > log options which allows you to set %R to get the Remote IP Address.
>
> > > ~ Sammie
>
> > > On Sun, May 20, 2012 at 9:34 PM, cody <cbr...@gmail.com> wrote:
> > > > Hello,
>
> > > > We have our PHP-FPM deployment up and running and everything is
> > > > working great, however the Apache error_log is lacking some big
> > > > items we need and I cannot find anyway to get that info.  We would
> > > > like to see the REMOTE_IP in the logs, but I cannot find a way to do so...
>
> > > > FPM.conf:
>
> > > > php_admin_value[error_log] = /usr/local/apache/logs/error_log
> > > > php_admin_flag[log_errors] = on php_admin_value[error_reporting] =
> > > > E_ALL
>
> > > > Apache error_log:
>
> > > > Here is what I see when a PHP error happens... for some reason its
> > > > using UTC timezone as well.
>
> > > > [20-May-2012 21:09:05 UTC] foo bar
>
> > > > At minimum I would like to have REMOTE_IP passed to the log... any
> > > > ideas?
>
> > > > Thanks,
> > > > Cody
Re: PHP-FPM Apache error_log
August 15, 2012 09:58AM
cody Wrote:
-------------------------------------------------------
> I just don't get why it doesn't log the remote IP
> in the
> error_log.... Apache logs it fine and the old
> php-cgi method we used
> to use worked fine.
>

I believe this is either a bug or just the way php-fpm works. I've filed a bug report below:

https://bugs.php.net/bug.php?id=62828
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 186
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready