Join the community today
Register Now

PHP-FPM How to install mailparse PECL PHP extension for Centmin Mod

Discussion in 'Centmin Mod Insights' started by eva2000, Aug 14, 2015.

  1. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,574
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,756
    Local Time:
    9:57 AM
    Nginx 1.13.x
    MariaDB 5.5
    @Steve Tozer asked about mailparse PECL PHP extension for Blesta 3.5 usage requirements. As I also plan to use Blesta myself, posting a mailparse PHP extension install guide below.

    To install mailparse PHP extension - the 2.1.6 version for php 5.4-5.6 or 3.0.1 for php 7. Type following commands in SSH as root user.

    For mailparse 2.1.6 version for php 5.4-5.6
    Code:
    CONFIGSCANDIR='/etc/centminmod/php.d'
    PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`
    
    cd /svr-setup
    git clone https://git.php.net/repository/pecl/mail/mailparse.git mailparse-php
    cd mailparse-php
    git checkout tags/mailparse-2.1.6
    git checkout -b 2.1.6
    phpize
    ./configure --with-php-config=/usr/local/bin/php-config
    make -j2
    make install
    echo "extension=${PHPEXTDIRD}/mailparse.so" > ${CONFIGSCANDIR}/mailparse.ini
    nprestart
    
    For mailparse 3.0.1 version for php 7
    Code:
    CONFIGSCANDIR='/etc/centminmod/php.d'
    PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`
    
    cd /svr-setup
    git clone https://git.php.net/repository/pecl/mail/mailparse.git mailparse-php
    cd mailparse-php
    git checkout tags/mailparse-3.0.1
    git checkout -b 3.0.1
    phpize
    ./configure --with-php-config=/usr/local/bin/php-config
    make -j2
    make install
    echo "extension=${PHPEXTDIRD}/mailparse.so" > ${CONFIGSCANDIR}/mailparse.ini
    nprestart
    
    Then check mailparse PHP extension is loaded
    Code:
    php --ri mailparse
    
    mailparse
    
    mailparse support => enabled
    Extension Version => 2.1.6
    Revision => $Revision$
    
    Directive => Local Value => Master Value
    mailparse.def_charset => us-ascii => us-ascii
    
    You'll need to reinstall mailparse on major PHP upgrades, i.e. PHP 5.4 to 5.5 to 5.6.

    For php 5.4-5.6
    Code:
    CONFIGSCANDIR='/etc/centminmod/php.d'
    PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`
    
    cd /svr-setup
    rm -rf mailparse-php
    git clone https://git.php.net/repository/pecl/mail/mailparse.git mailparse-php
    cd mailparse-php
    git checkout tags/mailparse-2.1.6
    git checkout -b 2.1.6
    make clean
    phpize
    ./configure --with-php-config=/usr/local/bin/php-config
    make -j2
    make install
    echo "extension=${PHPEXTDIRD}/mailparse.so" > ${CONFIGSCANDIR}/mailparse.ini
    nprestart
    
    For php 7
    Code:
    CONFIGSCANDIR='/etc/centminmod/php.d'
    PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`
    
    cd /svr-setup
    rm -rf mailparse-php
    git clone https://git.php.net/repository/pecl/mail/mailparse.git mailparse-php
    cd mailparse-php
    git checkout tags/mailparse-3.0.1
    git checkout -b 3.0.1
    make clean
    phpize
    ./configure --with-php-config=/usr/local/bin/php-config
    make -j2
    make install
    echo "extension=${PHPEXTDIRD}/mailparse.so" > ${CONFIGSCANDIR}/mailparse.ini
    nprestart
    
     
    Last edited: Mar 1, 2016
    • Like Like x 1
  2. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,574
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,756
    Local Time:
    9:57 AM
    Nginx 1.13.x
    MariaDB 5.5
    FYI, mailparse 3.0.0 with PHP 7 support has been officially added to Centmin Mod 123.09beta01 branch - see info here.
    Code:
    php -v
    PHP 7.0.1 (cli) (built: Jan  3 2016 19:39:45) ( NTS )
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
        with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
    Code:
    php --ri mailparse
    
    mailparse
    
    mailparse support => enabled
    Extension Version => 3.0.0
    Revision => $Revision$
    
    Directive => Local Value => Master Value
    mailparse.def_charset => us-ascii => us-ascii
    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/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/mongodb.ini,
    /etc/centminmod/php.d/redis.ini,
    /etc/centminmod/php.d/zendopcache.ini,
    /etc/centminmod/php.d/zzzz_phpsessions.ini
    Code:
    php -m
    [PHP Modules]
    bcmath
    bz2
    calendar
    Core
    ctype
    curl
    date
    dom
    enchant
    exif
    filter
    ftp
    gd
    geoip
    gettext
    gmp
    hash
    iconv
    igbinary
    imagick
    imap
    intl
    json
    libxml
    mailparse
    mbstring
    mcrypt
    memcache
    memcached
    mongodb
    mysqli
    mysqlnd
    openssl
    pcntl
    pcre
    PDO
    pdo_mysql
    pdo_sqlite
    Phar
    posix
    pspell
    readline
    redis
    Reflection
    session
    shmop
    SimpleXML
    snmp
    soap
    sockets
    SPL
    sqlite3
    standard
    sysvmsg
    sysvsem
    sysvshm
    tidy
    tokenizer
    xml
    xmlreader
    xmlrpc
    xmlwriter
    Zend OPcache
    zip
    zlib
    
    [Zend Modules]
    Zend OPcache
     
    Last edited: Jan 4, 2016
    • Like Like x 1
  3. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,574
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,756
    Local Time:
    9:57 AM
    Nginx 1.13.x
    MariaDB 5.5
    Updated instructions for 123.08stable. Centmin 123.09beta01 have mailparse installed by default now.

    To install mailparse PHP extension - the 2.1.6 version for php 5.4-5.6 or 3.0.1 for php 7. Type following commands in SSH as root user.

    For mailparse 2.1.6 version for php 5.4-5.6
    Code:
    CONFIGSCANDIR='/etc/centminmod/php.d'
    PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`
    
    cd /svr-setup
    git clone https://git.php.net/repository/pecl/mail/mailparse.git mailparse-php
    cd mailparse-php
    git checkout tags/mailparse-2.1.6
    git checkout -b 2.1.6
    phpize
    ./configure --with-php-config=/usr/local/bin/php-config
    make -j2
    make install
    echo "extension=${PHPEXTDIRD}/mailparse.so" > ${CONFIGSCANDIR}/mailparse.ini
    nprestart
    
    For mailparse 3.0.1 version for php 7
    Code:
    CONFIGSCANDIR='/etc/centminmod/php.d'
    PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`
    
    cd /svr-setup
    git clone https://git.php.net/repository/pecl/mail/mailparse.git mailparse-php
    cd mailparse-php
    git checkout tags/mailparse-3.0.1
    git checkout -b 3.0.1
    phpize
    ./configure --with-php-config=/usr/local/bin/php-config
    make -j2
    make install
    echo "extension=${PHPEXTDIRD}/mailparse.so" > ${CONFIGSCANDIR}/mailparse.ini
    nprestart
    
    Then check mailparse PHP extension is loaded
    Code:
    php --ri mailparse
    
    mailparse
    
    mailparse support => enabled
    Extension Version => 2.1.6
    Revision => $Revision$
    
    Directive => Local Value => Master Value
    mailparse.def_charset => us-ascii => us-ascii
    
    You'll need to reinstall mailparse on major PHP upgrades, i.e. PHP 5.4 to 5.5 to 5.6.

    For php 5.4-5.6
    Code:
    CONFIGSCANDIR='/etc/centminmod/php.d'
    PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`
    
    cd /svr-setup
    rm -rf mailparse-php
    git clone https://git.php.net/repository/pecl/mail/mailparse.git mailparse-php
    cd mailparse-php
    git checkout tags/mailparse-2.1.6
    git checkout -b 2.1.6
    make clean
    phpize
    ./configure --with-php-config=/usr/local/bin/php-config
    make -j2
    make install
    echo "extension=${PHPEXTDIRD}/mailparse.so" > ${CONFIGSCANDIR}/mailparse.ini
    nprestart
    
    For php 7
    Code:
    CONFIGSCANDIR='/etc/centminmod/php.d'
    PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`
    
    cd /svr-setup
    rm -rf mailparse-php
    git clone https://git.php.net/repository/pecl/mail/mailparse.git mailparse-php
    cd mailparse-php
    git checkout tags/mailparse-3.0.1
    git checkout -b 3.0.1
    make clean
    phpize
    ./configure --with-php-config=/usr/local/bin/php-config
    make -j2
    make install
    echo "extension=${PHPEXTDIRD}/mailparse.so" > ${CONFIGSCANDIR}/mailparse.ini
    nprestart
    
     
    • Informative Informative x 1