Want to subscribe to topics you're interested in?
Become a Member

PHP-FPM Transfer all my custom changes from php.info to php-fpm config

Discussion in 'Centmin Mod Insights' started by rdan, Aug 28, 2014.

  1. eva2000

    eva2000 Administrator Staff Member

    54,107
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    8:49 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    relates to saving php sessions for all PHP apps

    only PHP-FPM needs restart and check memcached stats page PHP Opcode and Memcached statistics pages | Centmin Mod Community

     
  2. pamamolf

    pamamolf Premium Member Premium Member

    4,074
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    12:49 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    What i must check there as all info looking as before and i didn't see any increase at used Mb's ....
     
  3. eva2000

    eva2000 Administrator Staff Member

    54,107
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    8:49 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    variable / slab id and their respective items contents and item names - of course you need to know the item names for your sessions too and that depends on PHP app

    also session sizes usually very small so unless you have millions of concurrent sessions you probably won't notice much difference in sizes

    for example, xenforo forum session size is around 223 bytes
     
    Last edited: Mar 28, 2015
  4. pamamolf

    pamamolf Premium Member Premium Member

    4,074
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    12:49 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    And when memcached or server restarted the forum users will just have to login again to the forum or i will have more problems with it?

    Thanks
     
  5. eva2000

    eva2000 Administrator Staff Member

    54,107
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    8:49 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Depends on session cache length which for forums usually 900 seconds... so really should not matter on invalidation of cache on memcached restarts. This forum uses memcached sessions and have you had trouble with logins ? Not that often do I restart memcached though

    current uptime for memcached her eis ~20 days or 1,783,639 seconds

    Code:
    echo stats | nc 127.0.0.1 11211
    STAT pid 3549
    STAT uptime 1783639
    STAT time 1427558297
    STAT version 1.4.22
    STAT libevent 2.0.21-stable
    STAT pointer_size 64
    STAT rusage_user 350.596631
    STAT rusage_system 1211.109878
    STAT curr_connections 9
    STAT total_connections 652226
    STAT connection_structures 21
    STAT reserved_fds 20
    STAT cmd_get 17308120
    STAT cmd_set 1071670
    STAT cmd_flush 1
    STAT cmd_touch 0
    STAT get_hits 17099132
    STAT get_misses 208988
    STAT delete_misses 19
    STAT delete_hits 152
    STAT incr_misses 0
    STAT incr_hits 0
    STAT decr_misses 0
    STAT decr_hits 0
    STAT cas_misses 0
    STAT cas_hits 0
    STAT cas_badval 0
    STAT touch_hits 0
    STAT touch_misses 0
    STAT auth_cmds 0
    STAT auth_errors 0
    STAT bytes_read 4933988224
    STAT bytes_written 109119100711
    STAT limit_maxbytes 268435456
    STAT accepting_conns 1
    STAT listen_disabled_num 0
    STAT threads 4
    STAT conn_yields 0
    STAT hash_power_level 16
    STAT hash_bytes 524288
    STAT hash_is_expanding 0
    STAT slab_reassign_running 0
    STAT slabs_moved 64
    STAT malloc_fails 0
    STAT bytes 223613943
    STAT curr_items 44675
    STAT total_items 1071670
    STAT expired_unfetched 9899
    STAT evicted_unfetched 9311
    STAT evictions 11131
    STAT reclaimed 67040
    STAT crawler_reclaimed 0
    STAT lrutail_reflocked 0
    END
     
  6. pamamolf

    pamamolf Premium Member Premium Member

    4,074
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    12:49 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    No i do not have any problems as i don't test it yet and i am just asking before i use it :)
     
  7. pamamolf

    pamamolf Premium Member Premium Member

    4,074
    427
    83
    May 31, 2014
    Ratings:
    +833
    Local Time:
    12:49 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    As i can see there is already a related file named "a_customphp.ini" so is it better to edit this file or rename it or delete this one and use a new one with another name?

    It seems that this file is replaced as i can see a backup of it and i don't want to be replaced with a new one as the point of this file is to not get replaced.....:

    Code:
    a_customphp.ini-bak_240215-211438
    a_customphp.ini-bak_240315-233535
     
  8. eva2000

    eva2000 Administrator Staff Member

    54,107
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    8:49 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yes editing /etc/centminmod/php.d/a_customphp.ini is best if you want to keep customisations between PHP upgrades and no /etc/centminmod/php.d/a_customphp.ini is not replaced, the backups you see are part of the full backup PHP upgrades do regardless of overwrites
     
  9. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    2:49 PM
    For updating the Opcache size, should I do it via /etc/centminmod/php.d/zendopcache.ini or by adding a "opcache.memory_consumption=100" line to the a_customphp.ini file? I'm on .08 beta2
     
  10. eva2000

    eva2000 Administrator Staff Member

    54,107
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    8:49 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    either but i usually do it via /etc/centminmod/php.d/zendopcache.ini myself
     
  11. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    2:49 PM
    Makes sense to do it in zendopcache.ini to me--that way I'm not confused later to see a different value there than in my opcache status page because I've forgotten that it's getting overriden. :facepalm:

    However, if I do that, will the customization get wiped out when updating php via centminmod?
     
    Last edited: May 18, 2015
  12. eva2000

    eva2000 Administrator Staff Member

    54,107
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    8:49 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Only time zendcopcache.ini gets wiped is on major PHP upgrades i.e. 5.4 to 5.5 to 5.6 to 5.7/7 etc see code at lines 24-54 of inc/zendopcache_upgrade.inc and gets re-created at lines 155-180 of inc/zendopcache_upgrade.inc. This is so I can recalculate the zend_extension directory path which changes on major PHP version upgrade/downgrades

    i.e.

    Code:
    PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`
    Code:
    zend_extension=${PHPEXTDIRD}/opcache.so
    Code:
    echo zend_extension=${PHPEXTDIRD}/opcache.so
    zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/opcache.so
    I guess it would't be that hard to transplant the memory allocation value for opcache.memory_consumption from old to new zendopcache.ini something I'll look into :)

    edit: fixed and added commit to ensure zend opcache memory allocation value persists on PHP major version upgrades Ensure Zend Opcache memory allocation value persists on PHP major upg… · centminmod/centminmod@48179c8 · GitHub :)
     
    Last edited: May 18, 2015
  13. jeffwidman

    jeffwidman Active Member

    152
    27
    28
    Dec 3, 2014
    Ratings:
    +51
    Local Time:
    2:49 PM
    Thanks.

    Not a big deal for me, I've got an Ansible task that makes sure it's set to my specified value that runs as part of my suite of plays:).
     
  14. Andy

    Andy Active Member

    542
    89
    28
    Aug 6, 2014
    Ratings:
    +132
    Local Time:
    4:49 PM
    I'm trying to add a directory into the open_basedir path in the php.conf file but I found it got overwritten everytime I update.
    Is there a way to keep this custom value?
    I use this for the XF addon that creates backup.
    fastcgi_param PHP_ADMIN_VALUE open_basedir=$document_root/:/usr/local/lib/php/:/tmp/:/home/nginx/domains/backup/;
     
  15. eva2000

    eva2000 Administrator Staff Member

    54,107
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    8:49 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    When you upgrade or downgrade PHP, do you answer yes to overwrite php.conf ? that's why, if you answer no to overwrite, then you custom settings are retained

    Code:
    Update & overwrite your existing php-fpm.conf [y/n]:
    If you want to customise the base php.conf template located in Centmin Mod zip file at config/nginx/php.conf or on live server install at
    /usr/local/src/centmin-v1.2.3mod for .07 stable or /usr/local/src/centminmod-123.08centos7beta02 for .08 beta 02 so every overwrites have your custom /usr/local/nginx/conf/php.conf include file settings, you need to edit the Centmin Mod codes base config/nginx/php.conf template (inc/php_upgrade.inc line 419 to 426 is function that copies that base config/nginx/php.conf template to live location at /usr/local/nginx/conf/php.conf when you answer yes to overwrite /usr/local/nginx/conf/php.conf).
    Code:
    cp -f $CUR_DIR/config/nginx/php.conf /usr/local/nginx/conf/php.conf
    The base template config/nginx/php.conf can be also see on github hosted code at centminmod/php.conf at 123.08centos7beta02 · centminmod/centminmod · GitHub