Welcome! Log In Create A New Profile

Advanced

Have to restart php-fpm twice for restart to work

Posted by edbloom 
Have to restart php-fpm twice for restart to work
May 14, 2011 08:50PM
Hi there,

I have a linode 512 vps account running nginx 1.0.2 and php 5.3.3 on
Ubuntu 10.10

For some reason when I need to restart php (e.g. config change, new
process pool etc.) upon the first restart I sometimes get an nginx 502
bad gateway error. The restart itself goes fine via ssh - the error
shows up upon a screen refresh. Simply doing another restart of php
fixes the issue. I'm using /etc/init.d/php5-fpm refresh to do the
actual restart.

My config is a pretty standard nginx/php5-fpm config - I pass php
connections from nginx to php via port 9000.

I can see the error also in the nginx error log for the site in
question. e.g.
2011/05/15 01:39:42 [error] 9707#0: *133 connect() failed (111:
Connection refused) while connecting to upstream, client: myip,
server: mysite.com, request: "GET /favicon.ico HTTP/1.1", upstream:
"fastcgi://127.0.0.1:9000", host: "mysite.com"

Does anyone have any ideas?

The error would suggest that php is not running but the restart
doesn't thrown an error.
> I have a linode 512 vps account running nginx 1.0.2 and php 5.3.3 on
> Ubuntu 10.10

I run 10.10 on hardware.

> For some reason when I need to restart php (e.g. config change, new
> process pool etc.) upon the first restart I sometimes get an nginx 502
> bad gateway error. The restart itself goes fine via ssh - the error
> shows up upon a screen refresh. Simply doing another restart of php
> fixes the issue. I'm using /etc/init.d/php5-fpm refresh to do the
> actual restart.

Yes I find that php5-fpm isn't running after issuing a
/etc/init.d/php5-fpm, which is confirmed by 'ps'.

My work around is as follows:

$ /etc/init.d/php5-fpm stop && sleep 1 && /etc/init.d/php5-fpm start

My feeling is that one of the php5-* modules slows down the stopping
of the daemon. e.g. php5-mysql. Though I haven't investigated it any
further.

If you want to get to the root of the problem I suggest testing
/etc/init.d/php5-fpm restart in Ubuntu 11.04 and if the problem
persists log a bug with Ubuntu.
Re: Have to restart php-fpm twice for restart to work
May 14, 2011 09:35PM
sime Wrote:
-------------------------------------------------------
> > I have a linode 512 vps account running nginx
> 1.0.2 and php 5.3.3 on
> > Ubuntu 10.10
>
> I run 10.10 on hardware.
>
> > For some reason when I need to restart php (e.g.
> config change, new
> > process pool etc.) upon the first restart I
> sometimes get an nginx 502
> > bad gateway error. The restart itself goes fine
> via ssh - the error
> > shows up upon a screen refresh. Simply doing
> another restart of php
> > fixes the issue. I'm using /etc/init.d/php5-fpm
> refresh to do the
> > actual restart.
>
> Yes I find that php5-fpm isn't running after
> issuing a
> /etc/init.d/php5-fpm, which is confirmed by 'ps'.
>
> My work around is as follows:
>
> $ /etc/init.d/php5-fpm stop && sleep 1 &&
> /etc/init.d/php5-fpm start
>
> My feeling is that one of the php5-* modules slows
> down the stopping
> of the daemon. e.g. php5-mysql. Though I haven't
> investigated it any
> further.
>
> If you want to get to the root of the problem I
> suggest testing
> /etc/init.d/php5-fpm restart in Ubuntu 11.04 and
> if the problem
> persists log a bug with Ubuntu.

How about:

service php5-fpm restart
> > > I have a linode 512 vps account running nginx
> > 1.0.2 and php 5.3.3 on
> > > Ubuntu 10.10
>
> > I run 10.10 on hardware.
>
> > > For some reason when I need to restart php (e.g.
> > config change, new
> > > process pool etc.) upon the first restart I
> > sometimes get an nginx 502
> > > bad gateway error. The restart itself goes fine
> > via ssh - the error
> > > shows up upon a screen refresh. Simply doing
> > another restart of php
> > > fixes the issue. I'm using /etc/init.d/php5-fpm
> > refresh to do the
> > > actual restart.
>
> > Yes I find that php5-fpm isn't running after
> > issuing a
> > /etc/init.d/php5-fpm, which is confirmed by 'ps'.
>
> > My work around is as follows:
>
> > $ /etc/init.d/php5-fpm stop && sleep 1 &&
> > /etc/init.d/php5-fpm start
>
> > My feeling is that one of the php5-* modules slows
> > down the stopping
> > of the daemon. e.g. php5-mysql. Though I haven't
> > investigated it any
> > further.
>
> > If you want to get to the root of the problem I
> > suggest testing
> > /etc/init.d/php5-fpm restart in Ubuntu 11.04 and
> > if the problem
> > persists log a bug with Ubuntu.
>
> How about:
>
> service php5-fpm restart

That's essentially the same as /etc/init.d/php5-fpm restart. No
difference.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 188
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