On Tue, 2014-09-02 at 02:05 +1200, Christopher Gregory wrote:
> On Tue, 2014-09-02 at 01:35 +1200, Christopher Gregory wrote:
> > Hello,
> > 
> > Well I am at a total loss as to how to fix the issue that I have with
> > php-fpm.
> > 
> > I have enabled the systemd unit file, and I can view the phpinfo.php
> > file that I created for up to 3 minutes. 
> > 
> > Then I get the service unavailable message when trying to load the page
> > again.
> > 
> > I thought that it was an issue with php-fpm so went on a hunt through
> > google and saw that others had issues as well, so I tried various
> > things, ie checked config files, and turned on debug so I could at least
> > read the error log message.
> > 
> > This did not solve the issue, so I went ahead and upgraded php to the
> > latest new stable, 5.6.0 and got exactly the same results.
> > 
> > Out of desperation I took the line from the systemd unit file to
> > activate it:
> > /usr/sbin/php-fpm --nodaemonize --fpm-config /etc/php-fpm.conf
> > --pid /run/php-fpm.pid
> > 
> > and I removed the --nodaemonize option from it so that it would fork
> > normally.  It happily ran for 20 minutes before I manually killed the
> > process.
> > 
> > The log files kept giving:
> > 
> > 
> > ● php-fpm.service - The PHP FastCGI Process Manager
> >    Loaded: loaded (/lib/systemd/system/php-fpm.service; enabled)
> >    Active: failed (Result: timeout) since Tue 2014-09-02 01:22:33 NZST;
> > 3min 24s ago
> >   Process: 8369 ExecStart=/usr/sbin/php-fpm --nodaemonize
> > --fpm-config /etc/php-fpm.conf --pid /run/php-fpm.pid (code=exited,
> > status=0/SUCCESS)
> >  Main PID: 8369 (code=exited, status=0/SUCCESS)
> > 
> > Sep 02 01:22:33 lfs systemd[1]: php-fpm.service start operation timed
> > out. Terminating.
> > Sep 02 01:22:33 lfs systemd[1]: Failed to start The PHP FastCGI Process
> > Manager.
> > Sep 02 01:22:33 lfs systemd[1]: Unit php-fpm.service entered failed
> > state.
> > 
> > At this point it was back to google and I stumbled upon a less than
> > month old post on some sort of debian list that had the same issue
> > though their error was introduced by themselves.  The part of the error
> > that they got is that they had added:
> > /bin/systemd-tty-ask-password-agent --watch
> > to their systemd unit file.  This gave me a clue as to what to look for
> > when using systemctl to restart the service.  Of course the systemd unit
> > file that is provided does not have that in it.  I just double checked
> > to make sure.
> > 
> > However when I do systemctl restart php-fpm.service I see the
> > ask-password-agent spring to life.  This has now got me totally lost as
> > to where it is coming from. This is going to effect anyone who chooses
> > to use the latest book systemd to run a server that requires php pages.
> > 
> > I really need to get this fixed as I want to be able to install a server
> > that will have very limited traffic, ie LAN as opposed to WAN.  I need
> > to have it stable.
> > 
> > root      8311  0.0  0.1   5212  2076 pts/2    S+   01:12   0:00
> > systemctl restart php-fpm.service
> > root      8312  0.0  0.0   2376  1288 pts/2    S+   01:12
> > 0:00 /bin/systemd-tty-ask-password-agent --watch
> > root      8313  0.0  0.5  20368  8876 ?        Ss   01:12   0:00
> > php-fpm: master process
> > (/etc/php-fpm.conf)                                
> > apache    8314  0.0  0.2  20368  3452 ?        S    01:12   0:00
> > php-fpm: pool
> > www                                                          
> > apache    8315  0.0  0.2  20368  3452 ?        S    01:12   0:00
> > php-fpm: pool www
> > 
> > Regards,
> > 
> > Christopher.
> > 
> Hello,
> 
> Just tried again with systemctl --no-ask-password start php-fpm.service
> and whilst that does prevent the ask-password-agent from coming up, the
> result is still a timeout.  Invoked from the command line without using
> systemctl it correctly starts and remains running.
> 
> There have been suggestions of others using a socket activation method
> and a small bash script to kill the process manually via cron on a
> systemd system, but I have not yet tried it.  I am hoping there is a
> better solution to this.
> 
> Regards,
> 
> Christopher.
> 

Hello,

Well I have just tested this via socket activation and it works
perfectly.

I do not know if this is a bug in the current version of systemd or
within php-fpm itself.

I created a new php-fpm.conf with:


[global]
pid = /run/test-pool.pid
error_log = syslog
daemonize = no

[www]
listen = /run/test-pool.socket
user = apache
group = apache
pm = ondemand
pm.max_children = 10
slowlog = syslog

The unitfile as:

[Service]
ExecStart=/usr/sbin/php-fpm --fpm-config=/etc/test-pool.conf
Environment="FPM_SOCKETS=/run/test-pool.socket=3"

I got the information from:

http://thanatos.be/2014/04/12/php-fpm-ondemand.htm

They had the username and group in the unitfile, which my version of
systemd did not like.  By removing it the service starts and remains up
and the phpinfo.php page is rendered correctly.

Now I just have to create the kill script per the site and see.

Maybe someone else on the list can shed some light as to why it will
only work on socket activation.

Regards,

Christopher.

-- 
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to