Learn about Centmin Mod LEMP Stack today
Become a Member

PHP-FPM Exclude certain php from cacheing

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by julliuz, Feb 7, 2019.

  1. julliuz

    julliuz Member

    39
    3
    8
    Dec 20, 2018
    Ratings:
    +7
    Local Time:
    4:51 AM
    1.15
    Hi there

    I was accepted to try a adblock-blocking technology. They support APC and Xcache as a standard. When testing it logged in, it works flawlessly but once logged out, it seems to not work.


    A certain php backend loader has to be running when someone visits. How would I go about excluding that ? Or maybe exclude everything coming from a single plugin, folder or cookie ?

    Thank you
     
  2. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    You using APC or Xcache both are dated and less performant than Centmin Mod default installed Zend Opcache for PHP-FPM.

    To exclude per vhost, you can try similar approach to @nVidian for Zend Opcache PHP-FPM - Enable/Disable Zend Opcache per vhosts

    For APC Cache, see PHP: Runtime Configuration - Manual and apc.filters setting PHP: Runtime Configuration - Manual

    Then try something like caching - how to exclude .php file from APC cache? - Stack Overflow Edit /etc/centminmod/php.d/apc.ini APC Cache ini file which you can find using php --ini command for all .ini PHP related file paths

    Code:
    php --ini
    Configuration File (php.ini) Path: /usr/local/lib
    Loaded Configuration File:         /usr/local/lib/php.ini
    Scan for additional .ini files in: /etc/centminmod/php.d
    Additional .ini files parsed:      /etc/centminmod/php.d/apc.ini,
    /etc/centminmod/php.d/igbinary.ini,
    /etc/centminmod/php.d/imagick.ini,
    /etc/centminmod/php.d/memcache.ini,
    /etc/centminmod/php.d/memcached.ini
    Edit apc.ini and add

    Code:
    apc.filters = "-/home/nginx/domains/newdomain.com/public/.*"
    restart PHP-FPM service

    Code:
    service php-fpm restart
    or

    Code:
    fpmrestart
     
  3. julliuz

    julliuz Member

    39
    3
    8
    Dec 20, 2018
    Ratings:
    +7
    Local Time:
    4:51 AM
    1.15
    Oh, you mis understood, I'm not using apc or xcache :) (I am using centminmod with nothing but praise and love for it) I was saying that the specific plugin had support built in for those but not for zend opcache. Thank you, I'll look into the options above!
     
  4. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
  5. julliuz

    julliuz Member

    39
    3
    8
    Dec 20, 2018
    Ratings:
    +7
    Local Time:
    4:51 AM
    1.15
    Just another question @eva2000
    As read in this thread: Wordpress - Revisiting Wordpress Cache Enabler + Autoptimize Plugins For Page Load Speed Optimization

    <!--
    Centmin Mod centmin.sh menu option 22 auto installes Wordpress with Cache Enabler's advanced cache configuration when selecting option 1 above so header responses for php would have X-Cache-Handler: wp meaning caching bypasses PHP (php-fpm) for best performance as opposed to seeing X-Cache-Handler: php which means cache goes through PHP which isn't optimal.--!>

    My website was setup with cache enabler (option 1).
    Pages are showing x-cache handler WP
    how would I go about turning that into x-cache handler php ?
     
  6. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    12:51 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    that is best performance what you're asking is to lower performance/slow down your site by using x-cache handler php