Join the community today
Become a Member

PHP-FPM Beta Branch CentOS 7.x CentOS 7 Proper PHP-FPM systemd service file

Discussion in 'Beta release code' started by eva2000, Jan 26, 2019.

  1. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,840
    Local Time:
    9:26 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Update March 23, 2019: Centmin Mod 123.09beta01 has been updated so that by default PHP-FPM service file on CentOS 7 switches from init.d based to systemd based

    Proper CentOS 7 systemd service file implementations for both Nginx and PHP-FPM have been on my to do list so in light of discussions regarding PHP-FPM existing init.d service implementation, I am testing PHP-FPM systemd service file I have been developing for a while as a replacement to old init.d PHP-FPM service file implementation used in CentOS 7.

    The php-systemd.sh script used to switch from init.d PHP-FPM to systemd PHP-FPM service file implementation will eventually be available in 123.09beta01 and higher at tools/phpsystemd.sh within your Centmin Mod directory at /usr/local/src/centminmod.

    Switching to CentOS 7 systemd PHP-FPM service file can be done for now by running phpsystemd.sh with this command. It will replace /etc/init.d/php-fpm with systemd based service /usr/lib/systemd/system/php-fpm.service and update all cmd shortcuts i.e. fpmrestart, fpmstop, fpmstart, fpmreload, fpmstatus appropriately.
    Code (Text):
    curl -sL https://github.com/centminmod/centminmod/raw/123.09beta01/tools/php-systemd.sh | bash
    

    To update to latest version of php-systemd.sh, just re-run the command again.
    example output
    Code (Text):
    curl -sL https://github.com/centminmod/centminmod/raw/123.09beta01/tools/php-systemd.sh | bash
    Gracefully shutting down php-fpm ..... done
    systemctl daemon-reload
    
    systemctl restart php-fpm
    
    systemctl enable php-fpm
    
    systemctl status php-fpm
    ● php-fpm.service - PHP FastCGI Process Manager
       Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/php-fpm.service.d
               └─limit.conf
       Active: active (running) since Sat 2019-01-26 06:29:51 UTC; 79ms ago
     Main PID: 9595 (php-fpm)
       CGroup: /system.slice/php-fpm.service
               ├─9595 php-fpm: master process (/usr/local/etc/php-fpm.conf)
               ├─9596 php-fpm: pool www
               ├─9597 php-fpm: pool www
               ├─9598 php-fpm: pool www
               ├─9599 php-fpm: pool www
               ├─9600 php-fpm: pool www
               ├─9601 php-fpm: pool www
               ├─9602 php-fpm: pool www
               └─9603 php-fpm: pool www
    
    Jan 26 06:29:51 test.com systemd[1]: Starting PHP FastCGI Process Manager...
    Jan 26 06:29:51 test.com systemd[1]: Started PHP FastCGI Process Manager.
    


    If you have problems, you can switch back to init.d PHP-FPM service file by using restore command below. It update all cmd shortcuts i.e. fpmrestart, fpmstop, fpmstart, fpmreload, fpmstatus appropriately and put back in place /etc/init.d/php-fpm service file.
    Code (Text):
    curl -sL https://github.com/centminmod/centminmod/raw/123.09beta01/tools/php-systemd.sh | bash -s restore
    

    To update to latest version of php-systemd.sh, just re-run the command again.
    example output
    Code (Text):
    curl -sL https://github.com/centminmod/centminmod/raw/123.09beta01/tools/php-systemd.sh | bash -s restore
    systemctl daemon-reload
    
    service php-fpm start
    Starting php-fpm  done
    
    chkconfig on
    
    service php-fpm status
    php-fpm (pid 9786) is running...
    


     
  2. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,840
    Local Time:
    9:26 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    if you have php-fpm.conf set pm = dynamic process manager you will see php-fpm status output like
    Code (Text):
    systemctl status php-fpm
    ● php-fpm.service - PHP FastCGI Process Manager
       Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/php-fpm.service.d
              └─limit.conf
       Active: active (running) since Sat 2019-01-26 06:29:51 UTC; 79ms ago
     Main PID: 9595 (php-fpm)
       CGroup: /system.slice/php-fpm.service
              ├─9595 php-fpm: master process (/usr/local/etc/php-fpm.conf)
              ├─9596 php-fpm: pool www
              ├─9597 php-fpm: pool www
              ├─9598 php-fpm: pool www
              ├─9599 php-fpm: pool www
              ├─9600 php-fpm: pool www
              ├─9601 php-fpm: pool www
              ├─9602 php-fpm: pool www
              └─9603 php-fpm: pool www
    
    Jan 26 06:29:51 test.com systemd[1]: Starting PHP FastCGI Process Manager...
    Jan 26 06:29:51 test.com systemd[1]: Started PHP FastCGI Process Manager.
    

    if you have default pm = ondemand, you will only see master process unless there is active php-fpm worker process work being done.
    Code (Text):
    systemctl status php-fpm
    ● php-fpm.service - PHP FastCGI Process Manager
       Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/php-fpm.service.d
               └─limit.conf
       Active: active (running) since Sat 2019-01-26 06:49:09 UTC; 6s ago
     Main PID: 11715 (php-fpm)
       CGroup: /system.slice/php-fpm.service
               └─11715 php-fpm: master process (/usr/local/etc/php-fpm.conf)
    
    Jan 26 06:49:09 test.com systemd[1]: Stopped PHP FastCGI Process Manager.
    Jan 26 06:49:09 test.com systemd[1]: Starting PHP FastCGI Process Manager...
    Jan 26 06:49:09 test.com systemd[1]: Started PHP FastCGI Process Manager.
    
     
  3. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,840
    Local Time:
    9:26 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Updated 123.09beta01 and php-systemd.sh script to support PHP-FPM native systemd integration statistics as well. Update for 123.09beta01 now detects CentOS 7 systems and for PHP versions greater than 5.5, will add --with-fpm-systemd compile option when you run centmin.sh menu option 5 to update/recompile PHP.
    This allows PHP-FPM to pass statistics and info back to systemd.

    Then when you run php-systemd.sh with fpm-systemd option, it will check for PHP-FPM compilation with --with-fpm-systemd and then setup systemd PHP-FPM service file appropriately
    Code (Text):
    curl -sL https://github.com/centminmod/centminmod/raw/123.09beta01/tools/php-systemd.sh | bash -s fpm-systemd
    

    To update to latest version of php-systemd.sh, just re-run the command again.

    example output
    Code (Text):
    curl -sL https://github.com/centminmod/centminmod/raw/123.09beta01/tools/php-systemd.sh | bash -s fpm-systemd
    systemctl daemon-reload
    
    systemctl restart php-fpm
    
    systemctl enable php-fpm
    
    systemctl status php-fpm
    ● php-fpm.service - PHP FastCGI Process Manager
       Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/php-fpm.service.d
               └─limit.conf
       Active: active (running) since Sat 2019-01-26 11:20:20 UTC; 107ms ago
     Main PID: 29383 (php-fpm)
       Status: "Ready to handle connections"
       CGroup: /system.slice/php-fpm.service
               ├─29383 php-fpm: master process (/usr/local/etc/php-fpm.conf)
               ├─29384 php-fpm: pool www
               ├─29385 php-fpm: pool www
               ├─29386 php-fpm: pool www
               ├─29387 php-fpm: pool www
               ├─29388 php-fpm: pool www
               ├─29389 php-fpm: pool www
               ├─29390 php-fpm: pool www
               └─29391 php-fpm: pool www
    
    Jan 26 11:20:20 test.com systemd[1]: Starting PHP FastCGI Process Manager...
    Jan 26 11:20:20 test.com systemd[1]: php-fpm.service: Supervising process 29383 which is not our child. We'll most likely not notice when it exits.
    Jan 26 11:20:20 test.com systemd[1]: Started PHP FastCGI Process Manager.
    
    php-fpm systemd service setup
    with --with-fpm-systemd integration
    

    Notice the status line says
    Code (Text):
       Status: "Ready to handle connections"
    

    re-running PHP-FPM status later after ~10s will update with PHP-FPM statistics. The interval for refresh is set in /usr/local/etc/php-fpm.conf via systemd_interval setting which you need to add in as it's not set by default so defaults to 10 seconds.

    Code (Text):
    fpmstatus
    Redirecting to /bin/systemctl status php-fpm.service
    ● php-fpm.service - PHP FastCGI Process Manager
       Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/php-fpm.service.d
               └─limit.conf
       Active: active (running) since Sat 2019-01-26 11:20:20 UTC; 8min ago
     Main PID: 29383 (php-fpm)
       Status: "Processes active: 0, idle: 8, Requests: 1, slow: 0, Traffic: 0.0667req/sec"
       CGroup: /system.slice/php-fpm.service
               ├─29383 php-fpm: master process (/usr/local/etc/php-fpm.conf)
               ├─29384 php-fpm: pool www
               ├─29385 php-fpm: pool www
               ├─29386 php-fpm: pool www
               ├─29387 php-fpm: pool www
               ├─29388 php-fpm: pool www
               ├─29389 php-fpm: pool www
               ├─29390 php-fpm: pool www
               └─29391 php-fpm: pool www
    
    Jan 26 11:20:20 test.com systemd[1]: Starting PHP FastCGI Process Manager...
    Jan 26 11:20:20 test.com systemd[1]: php-fpm.service: Supervising process 29383 which is not our child. We'll most likely not notice when it exits.
    Jan 26 11:20:20 test.com systemd[1]: Started PHP FastCGI Process Manager.
    

    status line
    Code (Text):
       Status: "Processes active: 0, idle: 8, Requests: 1, slow: 0, Traffic: 0.0667req/sec"
    

    Remember, stats only show when you run centmin.sh menu option 5 to update/recompile PHP for CentOS 7 from now on with latest Centmin Mod 123.09beta01 updated version.

    There's an extra command shortcut = fpmstats too
    Code (Text):
    fpmstats
    Ready to handle connections
    
    fpmstats
    Processes active: 0, idle: 20, Requests: 0, slow: 0, Traffic: 0req/sec
    


    If on the other hand you want non-systemd integrated systemd PHP-FPM service file, just run without fpm-systemd option
    Code (Text):
    curl -sL https://github.com/centminmod/centminmod/raw/123.09beta01/tools/php-systemd.sh | bash
    
     
  4. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,840
    Local Time:
    9:26 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Heads up, looks like on server reboot, systemd based PHP-FPM service isn't starting up properly. So work in progress :) :oops:

    Update: fixed bug so reboot of server will properly start up PHP-FPM systemd based service :D
     
  5. rdan

    rdan Well-Known Member

    5,451
    1,412
    113
    May 25, 2014
    Ratings:
    +2,206
    Local Time:
    7:26 AM
    Mainline
    10.2
    Thanks Eva!
    Code:
    # curl -sL https://gist.githubusercontent.com/centminmod/a84a86775925ea558fece1f0ac130be3/raw/php-systemd.sh | bash -s fpm-systemd
    Gracefully shutting down php-fpm .......... done
    systemctl daemon-reload
    
    systemctl restart php-fpm
    
    systemctl enable php-fpm
    Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.
    
    systemctl status php-fpm
    ● php-fpm.service - PHP FastCGI Process Manager
       Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/php-fpm.service.d
               └─limit.conf
       Active: active (running) since Sun 2019-01-27 16:02:53 PST; 33ms ago
     Main PID: 24474 (php-fpm)
       CGroup: /system.slice/php-fpm.service
               ├─24474 php-fpm: master process (/usr/local/etc/php-fpm.conf)
               ├─24475 php-fpm: pool www
               ├─24476 php-fpm: pool www
               ├─24477 php-fpm: pool www
               ├─24478 php-fpm: pool www
               ├─24479 php-fpm: pool www
               ├─24480 php-fpm: pool www
               ├─24481 php-fpm: pool www
               ├─24482 php-fpm: pool www
               ├─24483 php-fpm: pool www
               ├─24484 php-fpm: pool www
               ├─24485 php-fpm: pool www
               ├─24486 php-fpm: pool www
               ├─24488 php-fpm: pool www
               ├─24489 php-fpm: pool www
               ├─24490 php-fpm: pool www
               ├─24491 php-fpm: pool www
               ├─24492 php-fpm: pool www
               ├─24493 php-fpm: pool www
               ├─24494 php-fpm: pool www
               ├─24495 php-fpm: pool www
               ├─24496 php-fpm: pool www
               ├─24497 php-fpm: pool www
               ├─24498 php-fpm: pool www
               ├─24499 php-fpm: pool www
               ├─24500 php-fpm: pool www
               ├─24501 php-fpm: pool www
               ├─24502 php-fpm: pool www
               ├─24503 php-fpm: pool www
               ├─24504 php-fpm: pool www
               ├─24505 php-fpm: pool www
               ├─24506 php-fpm: pool www
               └─24509 php-fpm: pool www
    
    Jan 27 16:02:53 phc-sp-64-sgp-e3-1245v5-64gb.phc.onl systemd[1]: Starting PHP FastCGI Process Manager...
    Jan 27 16:02:53 phc-sp-64-sgp-e3-1245v5-64gb.phc.onl systemd[1]: Started PHP FastCGI Process Manager.
    
    php-fpm systemd service setup
     
  6. rdan

    rdan Well-Known Member

    5,451
    1,412
    113
    May 25, 2014
    Ratings:
    +2,206
    Local Time:
    7:26 AM
    Mainline
    10.2
    Woah!

    # fpmrestart
    Redirecting to /bin/systemctl restart php-fpm.service

    Is instant.
     
  7. rdan

    rdan Well-Known Member

    5,451
    1,412
    113
    May 25, 2014
    Ratings:
    +2,206
    Local Time:
    7:26 AM
    Mainline
    10.2
    But having small issue:
     
  8. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,840
    Local Time:
    9:26 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    run one more time
    Code (Text):
    curl -sL https://github.com/centminmod/centminmod/raw/123.09beta01/tools/php-systemd.sh | bash -s fpm-systemd
    

    oh forgot to update np* commands LOL
     
  9. rdan

    rdan Well-Known Member

    5,451
    1,412
    113
    May 25, 2014
    Ratings:
    +2,206
    Local Time:
    7:26 AM
    Mainline
    10.2
    vs

     
  10. rdan

    rdan Well-Known Member

    5,451
    1,412
    113
    May 25, 2014
    Ratings:
    +2,206
    Local Time:
    7:26 AM
    Mainline
    10.2
    Still
    I even logout and then re-login on shell.
     
  11. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,840
    Local Time:
    9:26 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    no i mean i forgot to update nprestart commands, doing that now :)
     
  12. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,840
    Local Time:
    9:26 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    updated now so just reinstall the curl php-systemd.sh command again :)

    Code (Text):
    npstop
    Stopping nginx (via systemctl):                            [  OK  ]
    Stopping php-fpm (via systemctl) [  OK  ]
    
    npstart
    Starting nginx (via systemctl):                            [  OK  ]
    Starting php-fpm (via systemctl) [  OK  ]
    
    nprestart
    Restarting nginx (via systemctl):                          [  OK  ]
    Restarting php-fpm (via systemctl) [  OK  ]
    
    npreload
    Reloading nginx configuration (via systemctl):             [  OK  ]
    Reloading php-fpm (via systemctl) [  OK  ]
    

    Code (Text):
    fpmstop
    Stopping php-fpm (via systemctl) [  OK  ]
    
    fpmstart
    Starting php-fpm (via systemctl) [  OK  ]
    
    fpmrestart
    Restarting php-fpm (via systemctl) [  OK  ]
    

    Code (Text):
    fpmstatus
    ● php-fpm.service - PHP FastCGI Process Manager
       Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/php-fpm.service.d
               └─limit.conf
       Active: active (running) since Sun 2019-01-27 08:25:17 UTC; 3s ago
     Main PID: 18840 (php-fpm)
       Status: "Ready to handle connections"
       CGroup: /system.slice/php-fpm.service
               ├─18840 php-fpm: master process (/usr/local/etc/php-fpm.conf)
               ├─18841 php-fpm: pool www
               ├─18842 php-fpm: pool www
               ├─18843 php-fpm: pool www
               ├─18844 php-fpm: pool www
               ├─18845 php-fpm: pool www
               ├─18846 php-fpm: pool www
               ├─18847 php-fpm: pool www
               ├─18848 php-fpm: pool www
               ├─18849 php-fpm: pool www
               ├─18850 php-fpm: pool www
               ├─18851 php-fpm: pool www
               ├─18852 php-fpm: pool www
               ├─18853 php-fpm: pool www
               ├─18854 php-fpm: pool www
               ├─18855 php-fpm: pool www
               ├─18856 php-fpm: pool www
               ├─18857 php-fpm: pool www
               ├─18858 php-fpm: pool www
               ├─18859 php-fpm: pool www
               └─18860 php-fpm: pool www
    
    Jan 27 08:25:17 test.com systemd[1]: Starting PHP FastCGI Process Manager...
    Jan 27 08:25:17 test.com systemd[1]: php-fpm.service: Supervising process 18840 which is not our child. We'll most likely not notice when it exits.
    Jan 27 08:25:17 test.com systemd[1]: Started PHP FastCGI Process Manager.
    
     
    Last edited: Jan 27, 2019
  13. rdan

    rdan Well-Known Member

    5,451
    1,412
    113
    May 25, 2014
    Ratings:
    +2,206
    Local Time:
    7:26 AM
    Mainline
    10.2
    Thanks!
    Code (Text):
    # curl -sL https://gist.githubusercontent.com/centminmod/a84a86775925ea558fece1f0ac130be3/raw/php-systemd.sh | bash -s fpm-systemd
    systemctl daemon-reload
    
    systemctl restart php-fpm
    
    systemctl enable php-fpm
    
    systemctl status php-fpm
    ● php-fpm.service - PHP FastCGI Process Manager
       Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/php-fpm.service.d
               └─limit.conf
       Active: active (running) since Sun 2019-01-27 16:30:22 PST; 33ms ago
     Main PID: 900 (php-fpm)
       CGroup: /system.slice/php-fpm.service
               ├─900 php-fpm: master process (/usr/local/etc/php-fpm.conf)
               ├─901 php-fpm: pool www
               ├─902 php-fpm: pool www
               ├─903 php-fpm: pool www
               ├─904 php-fpm: pool www
               ├─905 php-fpm: pool www
               ├─906 php-fpm: pool www
               ├─907 php-fpm: pool www
               ├─908 php-fpm: pool www
               ├─909 php-fpm: pool www
               ├─910 php-fpm: pool www
               ├─911 php-fpm: pool www
               ├─912 php-fpm: pool www
               ├─914 php-fpm: pool www
               ├─915 php-fpm: pool www
               ├─916 php-fpm: pool www
               ├─917 php-fpm: pool www
               ├─918 php-fpm: pool www
               ├─919 php-fpm: pool www
               ├─920 php-fpm: pool www
               ├─921 php-fpm: pool www
               ├─922 php-fpm: pool www
               ├─923 php-fpm: pool www
               ├─924 php-fpm: pool www
               ├─925 php-fpm: pool www
               ├─926 php-fpm: pool www
               ├─927 php-fpm: pool www
               ├─928 php-fpm: pool www
               ├─929 php-fpm: pool www
               ├─930 php-fpm: pool www
               ├─931 php-fpm: pool www
               ├─934 php-fpm: pool www
               └─939 php-fpm: pool www
    
    Jan 27 16:30:22 host systemd[1]: Starting PHP FastCGI Process Manager...
    Jan 27 16:30:22 host systemd[1]: Started PHP FastCGI Process Manager.
    
    php-fpm systemd service setup
    [16:30][root@host ~]#
    [16:30][root@host ~]# nprestart
    Restarting nginx (via systemctl):                          [  OK  ]
    Restarting php-fpm (via systemctl) [  OK  ]
    [16:30][root@host ~]# fpmrestart
    Restarting php-fpm (via systemctl) [  OK  ]
    [16:30][root@host ~]# ngxrestart
    Restarting nginx (via systemctl):                          [  OK  ]
    [16:30][root@host ~]# fpmstop
    Stopping php-fpm (via systemctl) [  OK  ]
    [16:31][root@host ~]# fpmstart
    Starting php-fpm (via systemctl) [  OK  ]
    [16:31][root@host ~]# fpmstatus
    ● php-fpm.service - PHP FastCGI Process Manager
       Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
      Drop-In: /etc/systemd/system/php-fpm.service.d
               └─limit.conf
       Active: active (running) since Sun 2019-01-27 16:31:16 PST; 6s ago
     Main PID: 1299 (php-fpm)
       CGroup: /system.slice/php-fpm.service
               ├─1299 php-fpm: master process (/usr/local/etc/php-fpm.conf)
               ├─1300 php-fpm: pool www
               ├─1301 php-fpm: pool www
               ├─1302 php-fpm: pool www
               ├─1303 php-fpm: pool www
               ├─1304 php-fpm: pool www
               ├─1305 php-fpm: pool www
               ├─1306 php-fpm: pool www
               ├─1307 php-fpm: pool www
               ├─1308 php-fpm: pool www
               ├─1309 php-fpm: pool www
               ├─1310 php-fpm: pool www
               ├─1311 php-fpm: pool www
               ├─1312 php-fpm: pool www
               ├─1313 php-fpm: pool www
               ├─1314 php-fpm: pool www
               ├─1315 php-fpm: pool www
               ├─1316 php-fpm: pool www
               ├─1317 php-fpm: pool www
               ├─1318 php-fpm: pool www
               ├─1319 php-fpm: pool www
               ├─1320 php-fpm: pool www
               ├─1321 php-fpm: pool www
               ├─1322 php-fpm: pool www
               ├─1323 php-fpm: pool www
               ├─1324 php-fpm: pool www
               ├─1325 php-fpm: pool www
               ├─1326 php-fpm: pool www
               ├─1327 php-fpm: pool www
               ├─1328 php-fpm: pool www
               ├─1329 php-fpm: pool www
               ├─1330 php-fpm: pool www
               └─1331 php-fpm: pool www
    
    Jan 27 16:31:16 host systemd[1]: Starting PHP FastCGI Process Manager...
    Jan 27 16:31:16 host systemd[1]: Started PHP FastCGI Process Manager.
    [16:31][root@host ~]# fpmreload
    Reloading php-fpm (via systemctl) [  OK  ]
    
     
  14. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,840
    Local Time:
    9:26 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Remember, stats only show when you run centmin.sh menu option 5 to update/recompile PHP for CentOS 7 from now on with latest Centmin Mod 123.09beta01 updated version. Then run
    Code (Text):
    curl -sL https://github.com/centminmod/centminmod/raw/123.09beta01/tools/php-systemd.sh | bash -s fpm-systemd
    

    There's an extra command shortcut = fpmstats too
    Code (Text):
    fpmstats
    Ready to handle connections
    
    fpmstats
    Processes active: 0, idle: 20, Requests: 0, slow: 0, Traffic: 0req/sec
    
     
  15. rdan

    rdan Well-Known Member

    5,451
    1,412
    113
    May 25, 2014
    Ratings:
    +2,206
    Local Time:
    7:26 AM
    Mainline
    10.2
    When rebuilding PHP via menu #5, I still got this:
    Code:
    service php-fpm restart
    Redirecting to /bin/systemctl restart php-fpm.service
    Instead of:
    Code:
    fpmrestart
    Restarting php-fpm (via systemctl) [  OK  ]
    
     
  16. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,840
    Local Time:
    9:26 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    need to run latest php-systemd.sh curl command for the updated output

    and only works with command shortcuts fpm* not service php-fpm restart ones
     
  17. rdan

    rdan Well-Known Member

    5,451
    1,412
    113
    May 25, 2014
    Ratings:
    +2,206
    Local Time:
    7:26 AM
    Mainline
    10.2
    But nginx works fine?
     
  18. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,840
    Local Time:
    9:26 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yes Nginx still uses init.d not systemd service file so that is it's output. Default systemd php-fpm has no output for systemctl restart php-fpm and only redirect output for service php-fpm restart. The command shortcut fpmrestart has custom output i added myself to mimick and match nginx's output format for nprestart command purposes
    Code (Text):
    nprestart
    Restarting nginx (via systemctl):                          [  OK  ]
    Restarting php-fpm (via systemctl) [  OK  ]
    
     
  19. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,840
    Local Time:
    9:26 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Updated php-systemd.sh custom fpmstats command shortcut to add more PHP-FPM stats from phpstatus output if you have enabled it via instructions here. With PHP-FPM phpstatus output enabled you can grab PHP-FPM pool stats from /phpstatus url from main hostname or localhost
    Code (Text):
    curl -s localhost/phpstatus
    pool:                 www
    process manager:      static
    start time:           27/Jan/2019:12:10:27 +0000
    start since:          5530
    accepted conn:        7
    listen queue:         0
    max listen queue:     0
    listen queue len:     511
    idle processes:       19
    active processes:     1
    total processes:      20
    max active processes: 1
    max children reached: 0
    slow requests:        0
    

    so combine that with systemd integrated PHP-FPM health status info in fpmstats command shortcut will now show the following when you have phpstatus output enabled via instructions here
    Code (Text):
    fpmstats
    Processes active: 1, idle: 19, Requests: 44388, slow: 0, Traffic: 956req/sec
    pool:                 www
    process manager:      static
    start time:           27/Jan/2019:12:10:27 +0000
    start since:          72881
    accepted conn:        45860
    listen queue:         0
    max listen queue:     2
    listen queue len:     511
    idle processes:       19
    active processes:     1
    total processes:      20
    max active processes: 14
    max children reached: 0
    slow requests:        0
    

    with heavy PHP-FPM traffic
    Code (Text):
    fpmstats
    Processes active: 6, idle: 14, Requests: 563935, slow: 0, Traffic: 4.04e+03req/sec
    pool:                 www
    process manager:      static
    start time:           27/Jan/2019:12:10:27 +0000
    start since:          73770
    accepted conn:        570671
    listen queue:         2
    max listen queue:     14
    listen queue len:     511
    idle processes:       19
    active processes:     1
    total processes:      20
    max active processes: 20
    max children reached: 0
    slow requests:        0
    
     
  20. rdan

    rdan Well-Known Member

    5,451
    1,412
    113
    May 25, 2014
    Ratings:
    +2,206
    Local Time:
    7:26 AM
    Mainline
    10.2
    Please add this on new CMM install, maybe as custom_config.inc option disabled by default.
    Thanks!