Discover Centmin Mod today
Register Now

PHP-FPM MariaDB Insight Guide How to install phpiredis PHP extension

Discussion in 'Centmin Mod Insights' started by eva2000, Jul 9, 2016.

  1. eva2000

    eva2000 Administrator Staff Member

    53,488
    12,130
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,672
    Local Time:
    11:42 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    This is a how to guide for installing a phpredis alternative, phpiredis PHP extension which can talk to redis server via hiredis.

    Install hiredis




    Code (Text):
    cd /svr-setup
    rm -rf hiredis
    git clone https://github.com/redis/hiredis
    cd hiredis/
    git checkout v0.13.3
    make -j2
    make install
    

    check where hiredis library was installed
    Code (Text):
    cat /usr/local/lib/pkgconfig/hiredis.pc
    prefix=/usr/local
    exec_prefix=${prefix}
    libdir=/usr/local/lib
    includedir=/usr/local/include/hiredis
    
    Name: hiredis
    Description: Minimalistic C client library for Redis.
    Version: 0.13.3
    Libs: -L${libdir} -lhiredis
    Cflags: -I${includedir} -D_FILE_OFFSET_BITS=64
    

    install phpiredis



    Code (Text):
    cd /svr-setup
    rm -rf phpiredis
    git clone -b php7 https://github.com/nrk/phpiredis
    cd phpiredis
    phpize
    ./configure --enable-phpiredis --with-hiredis-dir=/usr/local --with-php-config=/usr/local/bin/php-config
    make -j2
    make install
    echo "extension=phpiredis.so" > /etc/centminmod/php.d/phpiredis.ini
    fpmrestart
    php --ri phpiredis
    


    Checks



    check phpiredis PHP extension is loaded
    Code (Text):
    php --ri phpiredis
    
    phpiredis
    
    Version => 1.0.0-dev
    

    right now phpredis PHP extension is also loaded
    Code (Text):
    php --ri redis
    
    redis
    
    Redis Support => enabled
    Redis Version => 2.2.8
    

    check for phpiredis.ini settings file /etc/centminmod/php.d/phpiredis.ini - not sure if you need to remove /etc/centminmod/php.d/redis.ini and restart php ?
    Code (Text):
    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/a_customphp.ini,
    /etc/centminmod/php.d/curlcainfo.ini,
    /etc/centminmod/php.d/geoip.ini,
    /etc/centminmod/php.d/igbinary.ini,
    /etc/centminmod/php.d/imagick.ini,
    /etc/centminmod/php.d/mailparse.ini,
    /etc/centminmod/php.d/memcache.ini,
    /etc/centminmod/php.d/memcached.ini,
    /etc/centminmod/php.d/phpiredis.ini,
    /etc/centminmod/php.d/redis.ini,
    /etc/centminmod/php.d/zendopcache.ini
    

    Code (Text):
    php -m
    [PHP Modules]
    bcmath
    bz2
    calendar
    Core
    ctype
    curl
    date
    dom
    enchant
    ereg
    exif
    filter
    ftp
    gd
    geoip
    gettext
    gmp
    hash
    iconv
    igbinary
    imagick
    imap
    intl
    json
    libxml
    mailparse
    mbstring
    mcrypt
    memcache
    memcached
    mhash
    mysql
    mysqli
    mysqlnd
    openssl
    pcntl
    pcre
    PDO
    pdo_mysql
    pdo_sqlite
    Phar
    phpiredis
    posix
    pspell
    readline
    redis
    Reflection
    session
    shmop
    SimpleXML
    snmp
    soap
    sockets
    SPL
    sqlite3
    standard
    sysvmsg
    sysvsem
    sysvshm
    tidy
    tokenizer
    xml
    xmlreader
    xmlrpc
    xmlwriter
    xsl
    Zend OPcache
    zip
    zlib
    
    [Zend Modules]
    Zend OPcache
    
     
    Last edited: Jul 9, 2016