Learn about Centmin Mod LEMP Stack today
Register Now

Nginx Insight Guide How To Guide For Nginx & PHP-FPM Debugging

Discussion in 'Centmin Mod Insights' started by eva2000, May 16, 2019.

Tags:
Thread Status:
Not open for further replies.
  1. eva2000

    eva2000 Administrator Staff Member

    42,086
    9,504
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,623
    Local Time:
    11:18 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Nginx and PHP-FPM debugging is a last resort to figure out issues you may have with Nginx and PHP-FPM which normal logs can no provide any insight into.

    If you have a lot of free disk space, you can enable debug nginx version and compile a nginx debug build of nginx with NGINX_DEBUG=y variable via persistent config /etc/centminmod/custom_config.inc outlined at centminmod.com/upgrade.html#persistent so place in file /etc/centminmod/custom_config.inc
    Code:
    NGINX_DEBUG=y
    then recompile nginx via centmin.sh menu option 4 and then in your nginx error_log directive add debug option outlined at debugging log and restart nginx and check logs

    They will be very very very verbose and lot alot to disk usage logged to error logs, so ensure you have a lot of disk free space.

    You can minimise this by limiting it to specific ip based client connections too
    After debugging is done, reverse the debug now by setting NGINX_DEBUG=n and recompile Nginx again

    Also check output for these commands - post output wrapped in CODE tags
    Code (Text):
    php -v

    Code (Text):
    php -m

    Code (Text):
    php-config --configure-options


    Examples with strace below:
    With gdb backtrace and PHP debug compiled mode where centmin.sh has a PHPDEBUGMODE variable which you can set to PHPDEBUGMODE=y and recompile php via centmin.sh menu option 5 to enable debug mode for PHP-FPM. After troubleshooting set PHPDEBUGMODE=n and recompile php via centmin.sh menu option 5 again to disable debug mode.
    Code:
    PHPDEBUGMODE=n # --enable-debug PHP compile flag
    Centmin Mod is provide as is, so short of scripted related bugs or issues, any further optimisation to the web stack components - nginx, php-fpm, mariadb mysql, csf firewall etc or web app specific configurations are left to the Centmin Mod user to deal with. So I do not provide any free support for such. Interpretation of the debug logs and outputs are left for you to figure out.

    You'll need to tune your PHP-FPM settings and this is left up to end user to do but here's a thread for starters to enable php status page output outlined at PHP-FPM - CentminMod.com LEMP Nginx web stack for CentOS and PHP-FPM - pm.max_children which outlines the official PHP-FPM config documentation as well. Also read How to troubleshoot & optimize PHP-FPM server?
     
    • Like Like x 1
Thread Status:
Not open for further replies.