Welcome to Centmin Mod Community
Register Now

PHP-FPM Custom search on forum

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Sunka, Aug 17, 2016.

  1. Sunka

    Sunka Active Member

    932
    242
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +392
    Local Time:
    7:04 AM
    Nginx 1.13.3
    MariaDB 10.1.24
    Regarding this, suggestion is:
    What to change and where.
    Should I change variable for FastCGI or for PHP-FPM or both?.

    far as I understand, my server use both (FastCGI and PHP-FPM).
    Where exactly should I add/change those variables?
    Maybe in /etc/centminmod/php.d/zzz_customphp.ini
     
  2. BobbyWibowo

    BobbyWibowo Active Member

    166
    36
    28
    Jul 30, 2015
    Medan, Indonesia
    Ratings:
    +57
    Local Time:
    1:04 PM
    Slightly off-topic, what did you enter for this?
    1471377310195screencapture.png
    I got this when searching for the relation between PHP-FPM and FastCGI (previously I was being indifferent about it):
    PHP-FPM is a PHP's FastCGI implementation; PHP-FPM runs as a standalone FastCGI server and Apache connects to the server using Apache's module, usually mod_fcgid or mod_fastcgi; I personally think this is way much better that running as mod_php, but it depends on your requirements and is also a little more complex; in this configuration, permission, processes related stuff & everything is run under PHP configuration, PHP user etc. & Apache connects to PHP as to a server; in this configuration it is also possible to have pool of PHP servers and to have PHP server on physically different machine than Apache. They say this is almost as fast as using Apache's module and there are benefits of better control over PHP configuration.
    I know it was also talking about Apache, but I needed very quick answer.
    So yeah, I'm sure we're all using FastCGI. But via what? lol

    EDIT: Never mind, I went with 'unsure'.
     
    Last edited: Aug 17, 2016
    • Like Like x 1
  3. Sunka

    Sunka Active Member

    932
    242
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +392
    Local Time:
    7:04 AM
    Nginx 1.13.3
    MariaDB 10.1.24
    As I remember, I do not have this question in survey.
    I see that quoted text is abouth apache and php-fpm, so if my server is only on nginx, it using PHP's FastCGI implementation too?
     
  4. BobbyWibowo

    BobbyWibowo Active Member

    166
    36
    28
    Jul 30, 2015
    Medan, Indonesia
    Ratings:
    +57
    Local Time:
    1:04 PM
    As far as I'm aware, if you're on nginx, which I assume we are all, and use PHP-FPM, then you're pretty much using FastCGI. I checked phpinfo() to double check and it said that its Server API was FPM/FastCGI, so yeah. But I guess, if people were to ask, "via what?", then the answer has to be PHP-FPM (I just remembered that things that begin with mod_ should be Apache modules).
     
    • Like Like x 1
  5. eva2000

    eva2000 Administrator Staff Member

    30,949
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,415
    Local Time:
    4:04 PM
    Nginx 1.13.x
    MariaDB 5.5
    that quote is in context of fastcgi for apache, not nginx usage of PHP-FPM an doesn't specifically mention which specific timeouts as there's many levels from php-fpm from max_execution_time timeouts in php.ini which you customise via outlined method at PHP-FPM - CentminMod.com LEMP Nginx web stack for CentOS to fastcgi connect, read, and send set in /usr/local/nginx/conf/php.conf include files like
    Code (Text):
    fastcgi_connect_timeout 60;
    fastcgi_send_timeout 180;
    fastcgi_read_timeout 180;

    easiest way is just to run the addon/script and let it timeout and see which time out settings it relates to
     
    • Informative Informative x 2
  6. eva2000

    eva2000 Administrator Staff Member

    30,949
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,415
    Local Time:
    4:04 PM
    Nginx 1.13.x
    MariaDB 5.5
    very bad for general php-fpm performance though so you may want to setup a dedicated php-fpm pool with it's own separate timeouts as 3000 seconds is bad

    you can probably re-purpose the preset multiple php-fpm pools available optionally in Centmin Mod 123.09beta01 builds see under Individual PHP Include Files Usage at Beta Branch - Centmin Mod .08 beta03+ Multiple PHP-FPM pools support added | Centmin Mod Community

    Just change the /admin location to where you want php-fpm pool2 to be used i.e. if custom search is from /search and remove auth_basic and allow/deny directives if not password protecting the directory

    Then just edit preset php-fpm pool2's php-fpm config file at /usr/local/nginx/conf/phpfpmd/phpfpm_pool2.conf to add a specific php.ini setting override i.e. max_execution_time at bottom of the file
    Code (Text):
    php_admin_value[max_execution_time] = 3000

    restart php-fpm service

    full /usr/local/nginx/conf/phpfpmd/phpfpm_pool2.conf file would look like
    Code (Text):
    [pool2]
    user = nginx
    group = nginx
    
    listen = 127.0.0.1:9002
    listen.allowed_clients = 127.0.0.1
    listen.backlog = 65535
    
    ;listen = /tmp/php5-fpm-pool2.sock
    listen.owner = nginx
    listen.group = nginx
    listen.mode = 0666
    
    pm = ondemand
    pm.max_children = 4
    ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
    pm.start_servers = 4
    pm.min_spare_servers = 2
    pm.max_spare_servers = 6
    pm.max_requests = 1000
    
    ; PHP 5.3.9 setting
    ; The number of seconds after which an idle process will be killed.
    ; Note: Used only when pm is set to 'ondemand'
    ; Default Value: 10s
    pm.process_idle_timeout = 10s;
    
    rlimit_files = 65536
    rlimit_core = 0
    
    ; The timeout for serving a single request after which the worker process will
    ; be killed. This option should be used when the 'max_execution_time' ini option
    ; does not stop script execution for some reason. A value of '0' means 'off'.
    ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
    ; Default Value: 0
    ;request_terminate_timeout = 0
    ; Default Value: 0
    ;request_slowlog_timeout = 0
    slowlog = /var/log/php-fpm/www-slow-pool2.log
    
    pm.status_path = /phpstatus-pool2
    ping.path = /phpping-pool2
    ping.response = pong
    
    ; Limits the extensions of the main script FPM will allow to parse. This can
    ; prevent configuration mistakes on the web server side. You should only limit
    ; FPM to .php extensions to prevent malicious users to use other extensions to
    ; exectute php code.
    ; Note: set an empty value to allow all extensions.
    ; Default Value: .php
    security.limit_extensions = .php .php3 .php4 .php5
    
    ; catch_workers_output = yes
    php_admin_value[error_log] = /var/log/php-fpm/www-php.error-pool2.log
    php_admin_value[disable_functions] = shell_exec
    php_admin_value[max_execution_time] = 3000
    
     
    Last edited: Aug 17, 2016
    • Informative Informative x 2
  7. Sunka

    Sunka Active Member

    932
    242
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +392
    Local Time:
    7:04 AM
    Nginx 1.13.3
    MariaDB 10.1.24
    More and more I am thinking to give up from that search addon :penguin:
     
  8. eva2000

    eva2000 Administrator Staff Member

    30,949
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,415
    Local Time:
    4:04 PM
    Nginx 1.13.x
    MariaDB 5.5
    • Like Like x 1
  9. Sunka

    Sunka Active Member

    932
    242
    43
    Oct 31, 2015
    Rijeka, Croatia
    Ratings:
    +392
    Local Time:
    7:04 AM
    Nginx 1.13.3
    MariaDB 10.1.24
    I have it also on my forum ;)

    22-40-34.png


    22-41-13.png
     
    • Like Like x 1
  10. eva2000

    eva2000 Administrator Staff Member

    30,949
    6,917
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,415
    Local Time:
    4:04 PM
    Nginx 1.13.x
    MariaDB 5.5
    yeah easier option to implement :)
     
    • Like Like x 1
  11. BobbyWibowo

    BobbyWibowo Active Member

    166
    36
    28
    Jul 30, 2015
    Medan, Indonesia
    Ratings:
    +57
    Local Time:
    1:04 PM
    I think I'll eventually try to use that custom search if they give me any invitation. Honestly, it looks pretty dope.