Join the community today
Register Now

Xenforo PHP Upgrade to 7.4+ breaking redis unserialize(): Error

Discussion in 'Forum software usage' started by Dnyan, Jun 14, 2020.

  1. Dnyan

    Dnyan Member

    95
    19
    8
    Sep 16, 2017
    Ratings:
    +26
    Local Time:
    10:54 PM
    1.17.8
    10.3.22
    Today i upgraded to PHP 7.4.7 and the website gone off with 500 error.

    tail -10 /var/log/php-fpm/www-php.error.log

    Code:
    PHP Notice:  unserialize(): Error at offset 0 of 2973 bytes in /home/nginx/domains/mydomain.com/public/src/XF/Cache/RedisCache.php on line 106
    [13-Jun-2020 16:46:00 UTC] PHP Notice:  unserialize(): Error at offset 0 of 8031 bytes in /home/nginx/domains/mydomain.com/public/src/XF/Cache/RedisCache.php on line 106
    [13-Jun-2020 16:46:00 UTC] PHP Fatal error:  Uncaught TypeError: Argument 1 passed to XF\Extension::__construct() must be of the type array, bool given, called in /home/nginx/domains/mydomain.com/public/src/XF/App.php on line 1465 and defined in /home/nginx/domains/mydomain.com/public/src/XF/Extension.php:12
    Stack trace:
    #0 /home/nginx/domains/mydomain.com/public/src/XF/App.php(1465): XF\Extension->__construct()
    #1 /home/nginx/domains/mydomain.com/public/src/XF/Container.php(28): XF\App->XF\{closure}()
    #2 /home/nginx/domains/mydomain.com/public/src/XF/App.php(2646): XF\Container->offsetGet()
    #3 /home/nginx/domains/mydomain.com/public/src/XF/App.php(2674): XF\App->extension()
    #4 /home/nginx/domains/mydomain.com/public/src/XF/App.php(1040): XF\App->extendClass()
    #5 /home/nginx/domains/mydomain.com/public/src/XF/Container.php(28): XF\App->XF\{closure}()
    #6 /home/nginx/domains/mydomain.com/public/src/XF/App.php(2422): XF\Container->offsetGet()
    #7 /home/nginx/domains/mydomain.com/public/src/XF.php(699): XF\App->fs()
    #8 /home/nginx/domains/mydomain.com/public/src/XF/Uti in /home/nginx/domains/mydomain.com/public/src/XF/Extension.php on line 12
    [13-Jun-2020 16:46:00 UTC] PHP Fatal error:  Uncaught TypeError: Argument 1 passed to XF\Extension::__construct() must be of the type array, bool given, called in /home/nginx/domains/mydomain.com/public/src/XF/App.php on line 1465 and defined in /home/nginx/domains/mydomain.com/public/src/XF/Extension.php:12
    Stack trace:
    #0 /home/nginx/domains/mydomain.com/public/src/XF/App.php(1465): XF\Extension->__construct()
    #1 /home/nginx/domains/mydomain.com/public/src/XF/Container.php(28): XF\App->XF\{closure}()
    #2 /home/nginx/domains/mydomain.com/public/src/XF/App.php(2646): XF\Container->offsetGet()
    #3 /home/nginx/domains/mydomain.com/public/src/XF/App.php(2674): XF\App->extension()
    #4 /home/nginx/domains/mydomain.com/public/src/XF/App.php(1040): XF\App->extendClass()
    #5 /home/nginx/domains/mydomain.com/public/src/XF/Container.php(28): XF\App->XF\{closure}()
    #6 /home/nginx/domains/mydomain.com/public/src/XF/App.php(2422): XF\Container->offsetGet()
    #7 /home/nginx/domains/mydomain.com/public/src/XF.php(699): XF\App->fs()
    #8 /home/nginx/domains/mydomain.com/public/src/XF/Uti in /home/nginx/domains/mydomain.com/public/src/XF/Extension.php on line 12
    I have following in my src/config for redis configuration

    Code:
    $config['cookie']['prefix'] = 'xfa_';
    
    // https://xenforo.com/xf2-docs/manual/cache/
    // global cache
    $config['cache']['enabled'] = true;
    $config['cache']['namespace'] = 'xfaredis_';
    $config['cache']['provider'] = 'Redis';
    $config['cache']['config'] = [
        'host' => '127.0.0.1',
        'port' => 6379,
        'serializer' => 'igbinary',
    //  'password' => 'password',
    //  'timeout' => 0.0,
        'database' => 3,
    //  'persistent' => true,
    //  'persistent_id' => 'global'
    ];
    
    // session cache
    $config['cache']['sessions'] = true;
    
    // guest page cache
    $config['pageCache']['enabled'] = true;
    $config['pageCache']['lifetime'] = 900;
    $config['pageCache']['recordSessionActivity'] = true;
    $config['cache']['context']['page']['namespace'] = 'xfaredispagecache_';
    $config['cache']['context']['page']['provider'] = 'Redis';
    $config['cache']['context']['page']['config'] = [
        'host' => '127.0.0.1',
        'port' => 6379,
        'serializer' => 'igbinary',
        'database' => 5,
    //  'timeout' => 1,
    //  'persistent' => true
    ];
    
    // css cache
    // $config['css']['enabled'] = true;
    $config['cache']['context']['css']['provider'] = 'Redis';
    $config['cache']['context']['css']['namespace'] = 'xfarediscsscache_';
    $config['cache']['context']['css']['config'] = [
        'host' => '127.0.0.1',
        'port' => 6379,
        'serializer' => 'igbinary',
        'database' => 7,
    //  'timeout' => 1,
    //  'persistent' => true
    ];
    Currently i commented out above lines and now website is up without redis cache.

    How can we fix this, please do help.

    I seen xon has posted fix at xenforo but i do not have idea about how to make use of it.
    Redis Cache By Xon

    Also i observed, PHP PGO wont work with xF and throws error on index path - is there any solution for this too?

    Thank You
     
  2. Sunka

    Sunka Well-Known Member

    1,140
    312
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +508
    Local Time:
    7:24 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    Try change row to:
    Code:
    $config['cache']['provider'] = 'SV\RedisCache\Redis';
     
  3. Dnyan

    Dnyan Member

    95
    19
    8
    Sep 16, 2017
    Ratings:
    +26
    Local Time:
    10:54 PM
    1.17.8
    10.3.22
  4. pamamolf

    pamamolf Premium Member Premium Member

    3,826
    370
    83
    May 31, 2014
    Ratings:
    +712
    Local Time:
    8:24 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Last edited: Jun 14, 2020
  5. eva2000

    eva2000 Administrator Staff Member

    44,731
    10,197
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,805
    Local Time:
    3:24 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    yeah remove the igbinary serializer setting
    Code (Text):
    'serializer' => 'igbinary',
    
     
  6. Dnyan

    Dnyan Member

    95
    19
    8
    Sep 16, 2017
    Ratings:
    +26
    Local Time:
    10:54 PM
    1.17.8
    10.3.22
    Thank You!

    Did you found any way to make profile guided optimization working on xF?
     
  7. eva2000

    eva2000 Administrator Staff Member

    44,731
    10,197
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,805
    Local Time:
    3:24 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
  8. Dnyan

    Dnyan Member

    95
    19
    8
    Sep 16, 2017
    Ratings:
    +26
    Local Time:
    10:54 PM
    1.17.8
    10.3.22
    Does adding PHP_PGO='y', willl help in improving performance without adding index path.
     
  9. eva2000

    eva2000 Administrator Staff Member

    44,731
    10,197
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,805
    Local Time:
    3:24 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    yes it may