=== Configuring php-fpm === When configuration php-fpm you are able to configure it using ports or sockets. \\ The best thing to do is configure with socks as this avoids the networking stack associated with ports. \\ This means that php-fpm will be using files (sockets) to run which could be considered slower because of potential slow HDDs however the files are mostly stored in RAM so it makes accessing them significantly quicker. \\ \\ CentOS 7, Ubuntu 12.04 LTS, Ubuntu 14.04 LTS uses FHS 3.0, this means that it uses /run for accessing RAM ^ Sockets ^ fastcgi_pass unix:/run/php-fpm/example.com.sock ^ ^ Ports ^ fastcgi_pass 127.0.0.1:9000; ^ \\ You are still able to refer to the FHS 2.4 as before however you are also able to access /run which is the new structure for 3.0 \\ For example the output of df -h on CentOS 7 looks like: # df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 1.8T 195G 1.6T 12% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 4.0K 1.9G 1% /dev/shm tmpfs 1.9G 41M 1.8G 3% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda1 190M 95M 82M 54% /boot \\ \\ === Configuring php-fpm Pool === To specify different server pools for each website you can create a website pool in the /etc/php-fpm.d/ directory. \\ E.g /etc/php-fpm.d/lukeslinux.co.uk \\ You would then want something similar to the following: [lukeslinux.co.uk] listen = /run/php-fpm/lukeslinux.co.uk.sock listen.allowed_clients = 127.0.0.1 user = nginx group = nginx pm = dynamic pm.max_children = 50 pm.start_servers = 5 pm.min_spare_servers = 5 pm.max_spare_servers = 35 slowlog = /var/log/php-fpm/lukeslinux.co.uk-slow.log php_admin_value[error_log] = /var/log/php-fpm/lukeslinux.co.uk-error.log php_admin_flag[log_errors] = on php_value[session.save_handler] = files php_value[session.save_path] = /var/lib/php/session \\ \\ === Troubleshooting ==== If you are looking to view the processes, you will need to use different commands depending on how its been configured: ^ Config ^ Command ^ | socket | netstat -plnx | grep 'php-fpm' | | port | netstat -plnt | grep 'php-fpm | \\ Example output of netstat -plnx: unix 2 [ ACC ] STREAM LISTENING 146689 21372/php-fpm: mast /run/php-fpm/lukeslinux.co.uk.sock \\ \\ === Website Issues === Make sure that php-fpm hasnt hit max processes; grep "pm.max_spare_servers" /etc/php-fpm.d/www.conf ps -eo cmd,pid,pcpu --sort:-pcpu | grep -v grep | grep -c php-fpm