Learn about Centmin Mod LEMP Stack today
Register Now

PHP-FPM session.serialize_handler

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Matt, May 27, 2014.

  1. Matt

    Matt Moderator Staff Member

    680
    313
    63
    May 25, 2014
    Sheffield, UK
    Ratings:
    +430
    Local Time:
    2:37 PM
    1.7.1
    MariaDB 10
    As igbinary is installed as part of the php-fpm setup with centminmod, is there any reason why it's not used as the session.serialize_handler for PHP?

    upload_2014-5-26_19-4-37.png

    I always use this where igbinary is available, and even better when Memcached is there to use for the session handler.

    Code:
    sed -i 's/session.save_handler = files/session.save_handler = memcached/g' /usr/local/lib/php.ini
    sed -i 's/;session.save_path = \"\/tmp\"/session.save_path = \"127.0.0.1:11211\"/g' /usr/local/lib/php.ini
    sed -i 's/session.serialize_handler = php/session.serialize_handler = igbinary/g' /usr/local/lib/php.ini
     
    • Like Like x 1
  2. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,748
    Local Time:
    11:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    @Matt where you are determining the usage ? AFAIK, default igbinary install does use the session.serialize_handler if you look at the code on Github at line 68 https://github.com/centminmod/centminmod/blob/123.07beta20/inc/igbinary.inc#L68

    Code:
    [igbinary]
    extension=igbinary.so
    ;Use igbinary as session serializer
    session.serialize_handler=igbinary
    
    ;Enable or disable compacting of duplicate strings
    igbinary.compact_strings=On
    
    ;Use igbinary as serializer in APC cache
    ;apc.serializer=igbinary
     
    Last edited: May 27, 2014
  3. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,748
    Local Time:
    11:37 PM
    Nginx 1.13.x
    MariaDB 5.5
  4. Matt

    Matt Moderator Staff Member

    680
    313
    63
    May 25, 2014
    Sheffield, UK
    Ratings:
    +430
    Local Time:
    2:37 PM
    1.7.1
    MariaDB 10
    From the default settings in php.ini

    This is the alert from the last update I did last night, where it reverted back to settings:

    Code:
    checking updated php.ini compared to old /usr/local/lib/php.ini-oldversion_250514-194519
    please note the following differences:
    if APC, Xcache, Memcache, Suhosin or FFMPEG Extensions are listed please re-install them
    
    --------------------------------------------------------------------------------------------
    375c375
    < max_execution_time = 60
    ---
    > max_execution_time = 300
    396c396
    < memory_limit = 128M
    ---
    > memory_limit = 256M
    913c913
    < date.timezone = UTC
    ---
    > date.timezone = Europe/London
    1361c1361
    < session.save_handler = files
    ---
    > session.save_handler = memcached
    1390c1390
    < ;session.save_path = "/tmp"
    ---
    > session.save_path = "127.0.0.1:11211"
    1440c1440
    < session.serialize_handler = php
    ---
    > session.serialize_handler = igbinary
    I didn't realise the included inc file over wrote the values in the php.ini file :oops:

    Code:
    ; Handler used to serialize data.  php is the standard serializer of PHP.
    ; http://php.net/session.serialize-handler
    session.serialize_handler = php
    upload_2014-5-26_19-29-35.png
     
  5. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,748
    Local Time:
    11:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    Yeah dynamically overwrite values so I can anticipate end users making PHP and php.ini related changes :D
     
    • Like Like x 1
  6. Matt

    Matt Moderator Staff Member

    680
    313
    63
    May 25, 2014
    Sheffield, UK
    Ratings:
    +430
    Local Time:
    2:37 PM
    1.7.1
    MariaDB 10
    It's just something I always changed manually when I was on a Cpanel server, so going to this makes it easier then (y)
     
  7. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,748
    Local Time:
    11:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    Centmin Mod evolved the way it did, as I want to save time too :D

    and FYI, the igbinary settings has it's own ini outside of php.ini so no need to add to php.ini

    so you can probably add your own custom settings to inc/igbinary.inc before actual install at lines 65 to 74 https://github.com/centminmod/centminmod/blob/123.07beta20/inc/igbinary.inc

    Code:
    ls -lah /etc/centminmod/php.d/
    total 32K
    drwxr-xr-x 2 root root 4.0K May 24 03:18 .
    drwxr-xr-x 3 root root 4.0K May 24 01:58 ..
    -rw-r--r-- 1 root root   19 May 24 03:18 geoip.ini
    -rw-r--r-- 1 root root  252 May 24 03:18 igbinary.ini
    -rw-r--r-- 1 root root   21 May 24 03:18 imagick.ini
    -rw-r--r-- 1 root root  115 May 24 03:18 memcached.ini
    -rw-r--r-- 1 root root   78 May 24 03:18 memcache.ini
    -rw-r--r-- 1 root root  382 May 24 03:23 zendopcache.ini
     
    Last edited: May 27, 2014
  8. RoldanLT

    RoldanLT Well-Known Member

    3,822
    928
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,256
    Local Time:
    9:37 PM
    1.11
    10.2
    So the performance is best when we use session.serialize_handler = igbinary compare to session.serialize_handler = php?
     
  9. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,568
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,748
    Local Time:
    11:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    It was with APC Cache combination. Haven't tested or seen benchmarks for Zend Opcache and igbinary based session.serialize_handler
     
    • Like Like x 1