#1  
Old 24th April 2013, 12:15
joemiller joemiller is offline
Junior Member
 
Join Date: Oct 2012
Location: Carlisle, United Kingdom
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
Exclamation php-fpm problems [Solved]

Hi, I'm running web servers using Centos 6.4 with nginx and php-fpm.
php-fpm version is php-fpm-5.4.14-1.el6.remi.x86_64
I've started getting the following errors in my log files:
Code:
Apr 24 07:45:30 web kernel: php-fpm[2262]: segfault at 7fff14fba001 ip 000000000068524c sp 00007fff14fb41c0 error 6 in php-fpm[400000+34b000]
I also have about 300 php-fpm processes running and the server is very slow. I've tried restarting php-fpm and got the same results;

There are no errors shown in /var/logs/php-fpm/error.log or in /var/logs/php-fpm/www-error.log.

This is the contents of /etc/init.d/php-fpm;
Code:
#! /bin/sh
#
# chkconfig: - 84 16
# description:  PHP FastCGI Process Manager
# processname: php-fpm
# config: /etc/php-fpm.conf
# pidfile: /var/run/php-fpm/php-fpm.pid

# Standard LSB functions
#. /lib/lsb/init-functions

# Source function library.
. /etc/init.d/functions

# Check that networking is up.
. /etc/sysconfig/network

# Additional environment file
if [ -f /etc/sysconfig/php-fpm ]; then
      . /etc/sysconfig/php-fpm
fi

if [ "$NETWORKING" = "no" ]
then
        exit 0
fi

RETVAL=0
prog="php-fpm"
pidfile=${PIDFILE-/var/run/php-fpm/php-fpm.pid}
lockfile=${LOCKFILE-/var/lock/subsys/php-fpm}

start () {
        echo -n $"Starting $prog: "
        dir=$(dirname ${pidfile})
        [ -d $dir ] || mkdir $dir
        daemon --pidfile ${pidfile} php-fpm --daemonize
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch ${lockfile}
}
stop () {
        echo -n $"Stopping $prog: "
        killproc -p ${pidfile} php-fpm
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ] ; then
                rm -f ${lockfile} ${pidfile}
        fi
}

restart () {
        stop
        start
}

reload () {
        echo -n $"Reloading $prog: "
        killproc -p ${pidfile} php-fpm -USR2
        RETVAL=$?
        echo
}


# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status -p ${pidfile} php-fpm
        RETVAL=$?
        ;;
  restart)
        restart
        ;;
  reload|force-reload)
        reload
        ;;
  condrestart|try-restart)
        [ -f ${lockfile} ] && restart || :
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|try-restart}"
        RETVAL=2
        ;;
esac

exit $RETVAL
This is the contents of /etc/php-fpm.conf
Code:
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;

; All relative paths in this configuration file are relative to PHP's install
; prefix.

; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
include=/etc/php-fpm.d/*.conf

;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;

[global]
; Pid file
; Default Value: none
pid = /var/run/php-fpm/php-fpm.pid

; Error log file
; Default Value: /var/log/php-fpm.log
error_log = /var/log/php-fpm/error.log

; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice

; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
;emergency_restart_threshold = 0

; Interval of time used by emergency_restart_interval to determine when 
; a graceful restart will be initiated.  This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;emergency_restart_interval = 0

; Time limit for child processes to wait for a reaction on signals from master.
; Available units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;process_control_timeout = 0

; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
; Default Value: yes
daemonize = yes

;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ; 
;;;;;;;;;;;;;;;;;;;;

; See /etc/php-fpm.d/*.conf
This is an example of the contents of /etc/php-fpm.d/web27.conf file. All other website.conf files are the same, the only thing which changes is the listening port.
Code:
[web27]

listen = 127.0.0.1:9036
listen.allowed_clients = 127.0.0.1

user = web27
group = client1

pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35

chdir = /

php_admin_value[open_basedir] = /var/www/clients/client1/web27/web:/var/www/clients/client1/web27/tmp:/var/www/carlislemc.northernculture.co.uk/web:/srv/www/carlislemc.northernculture.co.uk/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/usr/share/php
php_admin_value[session.save_path] = /var/www/clients/client1/web27/tmp
php_admin_value[upload_tmp_dir] = /var/www/clients/client1/web27/tmp
I have around 15 websites on the server, all fairly low traffic.
If I stop all php-fpm processes using
Code:
killall php-fpm
then the parts of my server that are running on ruby (Redmine) speed up to a normal speed
Can anyone suggest how I can fix this problem? It's slowing my webservers to a crawl!

Last edited by joemiller; 24th April 2013 at 18:09. Reason: Found my own solution
Reply With Quote
Sponsored Links
  #2  
Old 24th April 2013, 18:08
joemiller joemiller is offline
Junior Member
 
Join Date: Oct 2012
Location: Carlisle, United Kingdom
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
 
Default Solved

I think I've managed to solve this myself by following the instructions here.

Changed php-fpm configuration for each website to
Code:
pm = dynamic
pm.max_children = 5
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 200
then restarted php-fpm and nginx.
Reply With Quote
Reply

Bookmarks

Tags
php-fpm nginx

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with ispconfig 3 staff007 Installation/Configuration 4 10th October 2011 21:17
Centos 6.0 support Acid_Scorpion Developers' Forum 47 16th September 2011 10:36
Newly Installed ISPConfig3 on Ubuntu 8.04 : login redirect fail ? cripperz Installation/Configuration 5 22nd March 2009 12:15
Really Simple DNS Question andysm849 Server Operation 4 20th October 2008 23:32


All times are GMT +2. The time now is 18:20.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.