Php-fpm configuration: encountered and error

eva2000

Well-known member
I will never go this route, is a bit extreme. You are embarking on a HUGE work load. :)
If your system is well configured, you will not have any issues. For example, AXIVO PHP rpm is designed to recursively execute code present ONLY on /var/www directory, anywhere else it will not.
Well I already have jailed/chroot Nginx vhost menu working for Centmin Mod - just undergoing more internal tests while I build out other Centmin Mod feature support i.e. including Apache 2.4 event + PHP-FPM and OpenLiteSpeed + LSAPI PHP integration and concurrent mulitple PHP version support per Nginx vhost domain - already testing concurrent PHP 5.5, 5.6 or PHP NG (php-fpm) automated menu install and upgrade support. domain1.com using PHP 5.5 while domain2.com uses PHP 5.6 :D
 

MattW

Well-known member
@MattW, when you refer to owning the files, you are referring to XenForo php files/dirs? They should be owned ALL by root 0644/0755, except:
Code:
# pwd
/var/www/axivo.com
# ls -lha | grep data
drwxr-xr-x.  6 php-fpm root 4.0K Apr 23 23:20 data
drwxr-xr-x.  7 php-fpm root 4.0K Jun 23 10:53 internal_data
# chown -R php-fpm data
# find data -type f -exec chmod 0644 {} ';'
# find data -type d -exec chmod 0755 {} ';'
# chown -R php-fpm internal_data
# find internal_data -type f -exec chmod 0644 {} ';'
# find internal_data -type d -exec chmod 0755 {} ';'
Then, in your config.php file add:

Is not recommended to have a new user, use php-fpm as default user for sanity reasons.
AXIVO PHP rpm uses default base /var/www, not /var/www/html, as is more flexible. You can create a ton of separated directories into /var/www, like I did.
(y) That's all up and running now
 

Floren

Well-known member
Well I already have jailed/chroot Nginx vhost menu working for Centmin Mod
You are indeed crazy... is meant in a good way, a crazy workaholic! :D
Isn't Selinux a much more elegant solution? Selinux will also add a nice layer of protection, I have it enabled on all my servers:
Code:
# ls -laZ data
drwxr-xr-x. php-fpm root    system_u:object_r:httpd_sys_content_t:s0 .
drwxr-xr-x. root    root    system_u:object_r:httpd_sys_content_t:s0 ..
drwxr-xr-x. php-fpm php-fpm system_u:object_r:httpd_sys_content_t:s0 article_icons
drwxr-xr-x. php-fpm php-fpm system_u:object_r:httpd_sys_content_t:s0 attachments
drwxr-xr-x. php-fpm php-fpm system_u:object_r:httpd_sys_content_t:s0 avatars
-rw-r--r--. php-fpm root    system_u:object_r:httpd_sys_content_t:s0 index.html
drwxr-xr-x. php-fpm php-fpm system_u:object_r:httpd_sys_content_t:s0 resource_icons
 

eva2000

Well-known member
You are indeed crazy... is meant in a good way, a crazy workaholic! :D
Just waiting on the day someone ports LiteSpeed's LSAPI PHP handler to Nginx to replace PHP-FPM like someone did for Apache with mod_lsapi http://www.webhostingtalk.com/showthread.php?t=1386836 :)

Isn't Selinux a much more elegant solution? Selinux will also add a nice layer of protection, I have it enabled on all my servers:
Well remember what audience Centmin Mod caters too = majority aren't as system admin savy hence the shell menu based approach :)

first timing using XF 1.4 select and quote :D
 

Floren

Well-known member
Just waiting on the day someone ports LiteSpeed's LSAPI PHP handler to Nginx to replace PHP-FPM like someone did for Apache with mod_lsapi
I have partial reviews on that. I did not performed any tests as you are way more experienced than me... but LiteSpeed use some disproportionate words on their site: "World's fastest web server". They posted some stats but they forgot to mention they have the cache enabled. Nginx will destroy their results with cache enabled. They offer the config files, you can see there are ZERO optimizations to nginx config file. :)

I'm sure the Nginx developers are smiling... There is a saying in business: "Talk good about my product, talk bad about my product... just talk about my product."
 
Last edited:

eva2000

Well-known member
I have partial reviews on that. I did not performed any tests as you are way more experienced than me... but LiteSpeed use some disproportionate words on their site: "World's fastest web server". They posted some stats but they forgot to mention they have the cache enabled. Nginx will destroy their results with cache enabled. They offer the config files, you can see there are ZERO optimizations to nginx config file. :)

I'm sure the Nginx developers are smiling... There is a saying in business: "Talk good about my product, talk bad about my product... just talk about my product."
Done both tests cached static files Litespeed (and OpenLiteSpeed) and Nginx pretty even (when Nginx properly configured). For high throughput + heavy concurrency non-cached PHP requests LSAPI PHP > PHP-FPM.

If you restricted to 1 server with 4 cpu threads with server heavy concurrency + high throughput non-cached PHP requests, LSAPI PHP > PHP-FPM.

Of course LiteSpeed Enterprise targets a different market to Nginx.. how many Nginx based share web hosting providers do you know of ? There's a few just not that many. Edit: I'd like to see someone try configuring 200x shared web hosts accounts/sites individually for fastcgi_cache (PHP-FPM caching) for each and every one of their php web apps (wordpress, forum software, cms, ecommerce carts etc).

But we're getting off topic :D
 
Last edited:

Floren

Well-known member
how many Nginx based share web hosting providers do you know of ?
Of my memory and Google... Dreamhost, Digital Ocean, A Small Orange, WebFaction, NuBlue. IMO, it is pretty easy to setup a shared hosting with Nginx.
 

rdn

Well-known member
This is what I personally use now on axivo.com:
Code:
# cat /etc/security/limits.d/60-php-fpm.conf
php-fpm soft nofile 16384
php-fpm hard nofile 32768
# cat /etc/php-fpm.d/www.conf
;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;

; Multiple pools of child processes may be started with different listening
; ports and different management options.  The name of the pool will be
; used in logs and stats. There is no limitation on the number of pools which
; FPM can handle. Your system will tell you anyway :)

; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[www]
...
user = php-fpm
group = php-fpm
...
pm = dynamic
; pm.max_children = number pf procs x 4
; $ getconf _NPROCESSORS_ONLN
pm.max_children = 16
pm.start_servers = 6
pm.min_spare_servers = 2
pm.max_spare_servers = 10
pm.max_requests = 100
...
rlimit_files = 16384
...
php_admin_value[error_log] = /var/log/php-fpm/$pool.log
php_admin_value[date.timezone] = America/Montreal
php_admin_value[memory_limit] = 256M
php_admin_value[post_max_size] = 1M
php_admin_value[upload_max_filesize] = 1M
Any other settings are commented or let alone to their default values.
I've been debating if I should add be default the /etc/security/limits.d/60-php-fpm.conf file into AXIVO rpm... like I did for Elasticsearch. For Elasticsearch is truly imperative... still this is a very important setting. I will add them when a new version of software is released for MariaDB, Nginx and PHP. I will do PHP today, since they released version 5.5.15 a while ago, too busy on personal life. :)
So with my current server specs having 4 cores/8 threads:
Code:
pm = dynamic
; pm.max_children = number pf procs x 4
pm.max_children = 32
pm.start_servers = 6
pm.min_spare_servers = 2
pm.max_spare_servers = 10
pm.max_requests = 100
 

rdn

Well-known member
So with my current server specs having 4 cores/8 threads:
Code:
pm = dynamic
; pm.max_children = number pf procs x 4
pm.max_children = 32
pm.start_servers = 6
pm.min_spare_servers = 2
pm.max_spare_servers = 10
pm.max_requests = 100
Ops, with this settings, I always got an warning mostly every few seconds:
Code:
[03-Aug-2014 17:25:12] NOTICE: [pool www] child 17984 exited with code 0 after 99.844501 seconds from start
[03-Aug-2014 17:25:12] NOTICE: [pool www] child 18630 started
[03-Aug-2014 17:25:21] NOTICE: [pool www] child 17983 exited with code 0 after 109.446983 seconds from start
[03-Aug-2014 17:25:21] NOTICE: [pool www] child 18631 started
[03-Aug-2014 17:25:23] NOTICE: [pool www] child 17985 exited with code 0 after 109.627345 seconds from start
[03-Aug-2014 17:25:23] NOTICE: [pool www] child 18632 started
[03-Aug-2014 17:25:25] NOTICE: [pool www] child 17986 exited with code 0 after 109.766923 seconds from start
[03-Aug-2014 17:25:25] NOTICE: [pool www] child 18633 started
[03-Aug-2014 17:25:30] NOTICE: [pool www] child 17987 exited with code 0 after 111.569488 seconds from start
[03-Aug-2014 17:25:30] NOTICE: [pool www] child 18647 started
[03-Aug-2014 17:25:35] NOTICE: [pool www] child 17988 exited with code 0 after 116.444163 seconds from start
[03-Aug-2014 17:25:35] NOTICE: [pool www] child 18648 started
[03-Aug-2014 17:27:20] NOTICE: [pool www] child 18630 exited with code 0 after 127.465977 seconds from start
[03-Aug-2014 17:27:20] NOTICE: [pool www] child 19290 started
[03-Aug-2014 17:27:26] NOTICE: [pool www] child 18631 exited with code 0 after 125.113118 seconds from start
[03-Aug-2014 17:27:26] NOTICE: [pool www] child 19291 started
[03-Aug-2014 17:27:27] NOTICE: [pool www] child 18633 exited with code 0 after 122.227738 seconds from start
[03-Aug-2014 17:27:27] NOTICE: [pool www] child 19292 started
[03-Aug-2014 17:27:31] NOTICE: [pool www] child 18632 exited with code 0 after 127.989864 seconds from start
[03-Aug-2014 17:27:31] NOTICE: [pool www] child 19305 started
[03-Aug-2014 17:27:40] NOTICE: [pool www] child 18647 exited with code 0 after 130.340448 seconds from start
[03-Aug-2014 17:27:40] NOTICE: [pool www] child 19306 started
[03-Aug-2014 17:27:42] NOTICE: [pool www] child 18648 exited with code 0 after 126.366335 seconds from start
[03-Aug-2014 17:27:42] NOTICE: [pool www] child 19307 started
Any advice please.
 

rdn

Well-known member
Thanks @Floren , so, I've been and revised my settings.

Code:
pm = dynamic
pm.max_children = 50
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 25
pm.max_requests = 100
I'm going to spin up a VPS to play with, and do a full setup with your RPM's for everything. I might then have a go with my dedicated server ;)
I just use this settings, and the warning is gone.

Edit: Still suffering same error:
Code:
[03-Aug-2014 17:40:28] NOTICE: [pool www] child 21501 exited with code 0 after 156.959423 seconds from start
[03-Aug-2014 17:40:28] NOTICE: [pool www] child 22208 started
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 21503 exited with code 0 after 159.706106 seconds from start
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 22223 started
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 21506 exited with code 0 after 159.730659 seconds from start
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 22224 started
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 21500 exited with code 0 after 160.005155 seconds from start
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 22225 started
[03-Aug-2014 17:40:32] NOTICE: [pool www] child 21508 exited with code 0 after 160.835517 seconds from start
[03-Aug-2014 17:40:32] NOTICE: [pool www] child 22226 started
[03-Aug-2014 17:40:33] NOTICE: [pool www] child 21504 exited with code 0 after 161.824733 seconds from start
[03-Aug-2014 17:40:33] NOTICE: [pool www] child 22227 started
[03-Aug-2014 17:40:34] NOTICE: [pool www] child 21499 exited with code 0 after 162.724274 seconds from start
[03-Aug-2014 17:40:34] NOTICE: [pool www] child 22228 started
[03-Aug-2014 17:40:38] NOTICE: [pool www] child 21505 exited with code 0 after 166.420422 seconds from start
[03-Aug-2014 17:40:38] NOTICE: [pool www] child 22229 started
[03-Aug-2014 17:40:38] NOTICE: [pool www] child 21502 exited with code 0 after 166.888127 seconds from start
[03-Aug-2014 17:40:38] NOTICE: [pool www] child 22230 started
[03-Aug-2014 17:40:39] NOTICE: [pool www] child 21507 exited with code 0 after 168.229288 seconds from start
[03-Aug-2014 17:40:39] NOTICE: [pool www] child 22231 started
[03-Aug-2014 17:43:15] NOTICE: [pool www] child 22208 exited with code 0 after 166.880747 seconds from start
[03-Aug-2014 17:43:15] NOTICE: [pool www] child 22906 started
[03-Aug-2014 17:43:25] NOTICE: [pool www] child 22224 exited with code 0 after 174.107225 seconds from start
[03-Aug-2014 17:43:25] NOTICE: [pool www] child 22907 started
[03-Aug-2014 17:43:28] NOTICE: [pool www] child 22223 exited with code 0 after 177.376722 seconds from start
[03-Aug-2014 17:43:28] NOTICE: [pool www] child 22908 started
[03-Aug-2014 17:43:31] NOTICE: [pool www] child 22228 exited with code 0 after 176.778180 seconds from start
[03-Aug-2014 17:43:31] NOTICE: [pool www] child 22922 started
[03-Aug-2014 17:43:32] NOTICE: [pool www] child 22230 exited with code 0 after 173.608622 seconds from start
[03-Aug-2014 17:43:32] NOTICE: [pool www] child 22923 started
[03-Aug-2014 17:43:34] NOTICE: [pool www] child 22226 exited with code 0 after 182.343683 seconds from start
[03-Aug-2014 17:43:34] NOTICE: [pool www] child 22924 started
[03-Aug-2014 17:43:39] NOTICE: [pool www] child 22229 exited with code 0 after 181.056701 seconds from start
[03-Aug-2014 17:43:39] NOTICE: [pool www] child 22925 started
 
Last edited:

MattW

Well-known member
I just use this settings, and the warning is gone.

Edit: Still suffering same error:
Code:
[03-Aug-2014 17:40:28] NOTICE: [pool www] child 21501 exited with code 0 after 156.959423 seconds from start
[03-Aug-2014 17:40:28] NOTICE: [pool www] child 22208 started
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 21503 exited with code 0 after 159.706106 seconds from start
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 22223 started
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 21506 exited with code 0 after 159.730659 seconds from start
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 22224 started
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 21500 exited with code 0 after 160.005155 seconds from start
[03-Aug-2014 17:40:31] NOTICE: [pool www] child 22225 started
[03-Aug-2014 17:40:32] NOTICE: [pool www] child 21508 exited with code 0 after 160.835517 seconds from start
[03-Aug-2014 17:40:32] NOTICE: [pool www] child 22226 started
[03-Aug-2014 17:40:33] NOTICE: [pool www] child 21504 exited with code 0 after 161.824733 seconds from start
[03-Aug-2014 17:40:33] NOTICE: [pool www] child 22227 started
[03-Aug-2014 17:40:34] NOTICE: [pool www] child 21499 exited with code 0 after 162.724274 seconds from start
[03-Aug-2014 17:40:34] NOTICE: [pool www] child 22228 started
[03-Aug-2014 17:40:38] NOTICE: [pool www] child 21505 exited with code 0 after 166.420422 seconds from start
[03-Aug-2014 17:40:38] NOTICE: [pool www] child 22229 started
[03-Aug-2014 17:40:38] NOTICE: [pool www] child 21502 exited with code 0 after 166.888127 seconds from start
[03-Aug-2014 17:40:38] NOTICE: [pool www] child 22230 started
[03-Aug-2014 17:40:39] NOTICE: [pool www] child 21507 exited with code 0 after 168.229288 seconds from start
[03-Aug-2014 17:40:39] NOTICE: [pool www] child 22231 started
[03-Aug-2014 17:43:15] NOTICE: [pool www] child 22208 exited with code 0 after 166.880747 seconds from start
[03-Aug-2014 17:43:15] NOTICE: [pool www] child 22906 started
[03-Aug-2014 17:43:25] NOTICE: [pool www] child 22224 exited with code 0 after 174.107225 seconds from start
[03-Aug-2014 17:43:25] NOTICE: [pool www] child 22907 started
[03-Aug-2014 17:43:28] NOTICE: [pool www] child 22223 exited with code 0 after 177.376722 seconds from start
[03-Aug-2014 17:43:28] NOTICE: [pool www] child 22908 started
[03-Aug-2014 17:43:31] NOTICE: [pool www] child 22228 exited with code 0 after 176.778180 seconds from start
[03-Aug-2014 17:43:31] NOTICE: [pool www] child 22922 started
[03-Aug-2014 17:43:32] NOTICE: [pool www] child 22230 exited with code 0 after 173.608622 seconds from start
[03-Aug-2014 17:43:32] NOTICE: [pool www] child 22923 started
[03-Aug-2014 17:43:34] NOTICE: [pool www] child 22226 exited with code 0 after 182.343683 seconds from start
[03-Aug-2014 17:43:34] NOTICE: [pool www] child 22924 started
[03-Aug-2014 17:43:39] NOTICE: [pool www] child 22229 exited with code 0 after 181.056701 seconds from start
[03-Aug-2014 17:43:39] NOTICE: [pool www] child 22925 started
It's not an error, it's a notice. You can ignore it.
 
  • Like
Reactions: rdn

rdn

Well-known member
I just changes my settings to:
Code:
pm = dynamic
pm.max_children = 16
pm.start_servers = 6
pm.min_spare_servers = 2
pm.max_spare_servers = 10
pm.max_requests = 500
No more warning.
 

Floren

Well-known member
Ops, with this settings, I always got an warning mostly every few seconds:
Code:
[03-Aug-2014 17:25:12] NOTICE: [pool www] child 17984 exited with code 0 after 99.844501 seconds from start
[03-Aug-2014 17:25:12] NOTICE: [pool www] child 18630 started
[03-Aug-2014 17:25:21] NOTICE: [pool www] child 17983 exited with code 0 after 109.446983 seconds from start
[03-Aug-2014 17:25:21] NOTICE: [pool www] child 18631 started
[03-Aug-2014 17:25:23] NOTICE: [pool www] child 17985 exited with code 0 after 109.627345 seconds from start
[03-Aug-2014 17:25:23] NOTICE: [pool www] child 18632 started
[03-Aug-2014 17:25:25] NOTICE: [pool www] child 17986 exited with code 0 after 109.766923 seconds from start
[03-Aug-2014 17:25:25] NOTICE: [pool www] child 18633 started
[03-Aug-2014 17:25:30] NOTICE: [pool www] child 17987 exited with code 0 after 111.569488 seconds from start
[03-Aug-2014 17:25:30] NOTICE: [pool www] child 18647 started
[03-Aug-2014 17:25:35] NOTICE: [pool www] child 17988 exited with code 0 after 116.444163 seconds from start
[03-Aug-2014 17:25:35] NOTICE: [pool www] child 18648 started
[03-Aug-2014 17:27:20] NOTICE: [pool www] child 18630 exited with code 0 after 127.465977 seconds from start
[03-Aug-2014 17:27:20] NOTICE: [pool www] child 19290 started
[03-Aug-2014 17:27:26] NOTICE: [pool www] child 18631 exited with code 0 after 125.113118 seconds from start
[03-Aug-2014 17:27:26] NOTICE: [pool www] child 19291 started
[03-Aug-2014 17:27:27] NOTICE: [pool www] child 18633 exited with code 0 after 122.227738 seconds from start
[03-Aug-2014 17:27:27] NOTICE: [pool www] child 19292 started
[03-Aug-2014 17:27:31] NOTICE: [pool www] child 18632 exited with code 0 after 127.989864 seconds from start
[03-Aug-2014 17:27:31] NOTICE: [pool www] child 19305 started
[03-Aug-2014 17:27:40] NOTICE: [pool www] child 18647 exited with code 0 after 130.340448 seconds from start
[03-Aug-2014 17:27:40] NOTICE: [pool www] child 19306 started
[03-Aug-2014 17:27:42] NOTICE: [pool www] child 18648 exited with code 0 after 126.366335 seconds from start
[03-Aug-2014 17:27:42] NOTICE: [pool www] child 19307 started
Any advice please.
Disable notices, you are polluting your logs with useless information. On the other hand, look at the nice execution times you get now.
# grep log_level /etc/php/php-fpm.conf
log_level = warning
The setting is:
; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
log_level = warning
 

rdn

Well-known member
Disable notices, you are polluting your logs with useless information. On the other hand, look at the nice execution times you get now.

The setting is:
I just try this and got an error:
Code:
Starting php-fpm [04-Aug-2014 04:54:09] ERROR: [/usr/local/etc/php-fpm.conf:65] unknown entry 'log_level'
[04-Aug-2014 04:54:09] ERROR: failed to load configuration file '/usr/local/etc/php-fpm.conf'
[04-Aug-2014 04:54:09] ERROR: FPM initialization failed
failed
 
Top