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

PHP-FPM How to Install MongoDB PHP Extension?

Discussion in 'Centmin Mod Insights' started by rdan, May 11, 2015.

Tags:
  1. rdan

    rdan Well-Known Member

    5,439
    1,398
    113
    May 25, 2014
    Ratings:
    +2,187
    Local Time:
    12:21 PM
    Mainline
    10.2
    Can someone guide me?
    Did you try this already @eva2000

     
  2. eva2000

    eva2000 Administrator Staff Member

    53,535
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    2:21 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    similar to installing ssh2 PHP extension PHP-FPM - Install PHP extension ssh2 | Centmin Mod Community

    However, I have a test github Centmin Mod .08 beta02 branch with working MongoDB PHP extension for fresh installs or where you downgrade/upgrade via centmin.sh menu option to a major PHP version i.e. PHP 5.4 to 5.5 or 5.6 or PHP 5.6 to 5.5 or 5.4. Minor PHP downgrade/upgrades don't trigger the PHP extension detection/auto recompile routine.

    Something release later, unfortunately busy with paid client work right now.
     
  3. rdan

    rdan Well-Known Member

    5,439
    1,398
    113
    May 25, 2014
    Ratings:
    +2,187
    Local Time:
    12:21 PM
    Mainline
    10.2
    Code:
    cd /svr-setup
    wget https://github.com/mongodb/mongo-php-driver/archive/master.zip
    unzip master.zip
    cd mongo-php-driver-master/
    /usr/local/bin/phpize
    ./configure --with-php-config=/usr/local/bin/php-config
    make
    make install
    CONFIGSCANDIR='/etc/centminmod/php.d'
    touch ${CONFIGSCANDIR}/mongodb.ini
    echo "extension=mongo.so" > ${CONFIGSCANDIR}/mongodb.ini
    service php-fpm restart
    
    Done :)
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,535
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    2:21 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    perfect (y)

    exactly how I would of done it manually :)
     
  5. eva2000

    eva2000 Administrator Staff Member

    53,535
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    2:21 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  6. rdan

    rdan Well-Known Member

    5,439
    1,398
    113
    May 25, 2014
    Ratings:
    +2,187
    Local Time:
    12:21 PM
    Mainline
    10.2
    So to apply this and remove my custom install and edit.
    Delete the ${CONFIGSCANDIR}/mongodb.ini
    Then Re-Install PHP ?
     
  7. eva2000

    eva2000 Administrator Staff Member

    53,535
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    2:21 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    no need - just leave as is as your steps at PHP-FPM - How to Install MongoDB PHP Extension? | Centmin Mod Community are exactly the same as the update in code

    however, you'd want to update Centmin Mod .08 beta02 code + set in centmin.sh PHPMONGODB='y' itself so you can do reinstalls via centmin.sh menu option 5 and retain MongoDB PHP extension support
     
    Last edited: May 14, 2015
  8. Marcos

    Marcos New Member

    11
    4
    3
    Sep 3, 2018
    Ratings:
    +4
    Local Time:
    1:21 AM
    1.17.5
    MariaDB 10.3
    Hello!

    I did not activate mongodb in centmin.sh, and I ran # 5, but it was not.

    I searched the log, to make mongodb and neither in the log appeared.

    Im using Centmin 123.09beta01

    What could be happening?
     
  9. eva2000

    eva2000 Administrator Staff Member

    53,535
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    2:21 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    see guide at Install - PHP-FPM - MongoDB Server & mongodb PHP Extension Installation on CentOS 7.5 64bit for MongoDB PHP extension part

    what output do you get when you check mongodb php extension info
    Code (Text):
    php --ri mongodb
    

    example when mongodb extension is loaded
    Code (Text):
    php --ri mongodb
    
    mongodb
    
    MongoDB support => enabled
    MongoDB extension version => 1.5.1
    MongoDB extension stability => stable
    libbson bundled version => 1.11.0
    libmongoc bundled version => 1.11.0
    libmongoc SSL => enabled
    libmongoc SSL library => OpenSSL
    libmongoc crypto => enabled
    libmongoc crypto library => libcrypto
    libmongoc crypto system profile => disabled
    libmongoc SASL => enabled
    libmongoc ICU => enabled
    libmongoc compression => enabled
    libmongoc compression snappy => disabled
    libmongoc compression zlib => enabled
    
    Directive => Local Value => Master Value
    mongodb.debug => no value => no value
    

    If you don't get that, then need to check php upgrade log and provide more info
    • What version of PHP used ? Did you upgrade or downgrade PHP recently ? Which version did you upgrade from ?
    Every centmin.sh menu option has a full server log created with time stamped file name at /root/centminlogs. You can check that specific error log for clues or copy and paste log contents and post to pastebin.com or gist.github.com for sharing.

    To troubleshoot, you need to check the the php upgrade logs at /root/centminlogs and instructions under Sharing logs and errors heading for using Pastebin.com or Gists to share a sanitised version of the contents of the nginx_upgrade and php_upgrade logs. You can see full details at How to troubleshoot Centmin Mod initial install issues

    if you type this command it lists all logs in date ascending order so latest log at bottom
    Code (Text):
    ls -lArt /root/centminlogs

    so copy the entire contents of latest php_upgrade log to gist.github.com or pastebin.com

    you can use grep to filter the logs, i.e. look for nginx_upgrade or php in log name
    Code (Text):
    ls -lahrt /root/centminlogs/ | egrep 'nginx_upgrade|php_upgrade'
    

    Code (Text):
    ls -lahrt /root/centminlogs/ | egrep 'nginx_upgrade|php_upgrade'
    -rw-r--r--  1 root root  2.6M Oct  3 03:48 centminmod_1.2.3-eva2000.09.001_031016-034409_php_upgrade.log
    -rw-r--r--  1 root root  664K Oct 12 09:24 centminmod_1.2.3-eva2000.09.001_121016-092406_nginx_upgrade.log
    

    So the last php upgrade log was named centminmod_1.2.3-eva2000.09.001_031016-034409_php_upgrade.log and located at /root/centminlogs/centminmod_1.2.3-eva2000.09.001_031016-034409_php_upgrade.log
    then use cat command to output the contents of that log.

    clear your ssh window buffer/screen and type
    Code (Text):
    cat /root/centminlogs/centminmod_1.2.3-eva2000.09.001_031016-034409_php_upgrade.log

    then select and copy and paste output to pastebin.com or gist.github.com file to share. If your SSH client's scroll buffer isn't large enough using cat might not output the entire log file contents, so you may need to download the log and use local text editor to open and copy and paste.

    so only need content of a specific log, in this case most recent php_upgrade.log logs
     
    Last edited: Sep 3, 2018
  10. Marcos

    Marcos New Member

    11
    4
    3
    Sep 3, 2018
    Ratings:
    +4
    Local Time:
    1:21 AM
    1.17.5
    MariaDB 10.3
    Im using PHP 7.2.9

    I add
    PHPMONGODB='y'
    in /etc/centminmod/custom_config.inc

    And, centmin select #5

    gist:3086b9091a908306dfd1fec396ad2f72

    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/mcrypt.ini,
    /etc/centminmod/php.d/memcache.ini,
    /etc/centminmod/php.d/memcached.ini,
    /etc/centminmod/php.d/redis.ini
    
    Code:
    php --ri mongodb
    Extension 'mongodb' not present.
    
     
  11. eva2000

    eva2000 Administrator Staff Member

    53,535
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    2:21 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Do you have AUTODETECPHP_OVERRIDE='y' set in your persistent config file at /etc/centminmod/custom_config.inc ?

    what's contents of /etc/centminmod/custom_config.inc ?
    Code (Text):
    cat /etc/centminmod/custom_config.inc
    


    you never completed your installs form php upgrade log you answered no to not continue the upgrade
    Code (Text):
    [1;32;40m----------------------------------------------------
    (B[m[1;33;40mAuto reinstalling previously detected PHP extensions
    (B[m[1;32;40m----------------------------------------------------
    (B[m[1;33;40mAuto reinstalling previously detected PHP mssql extension
    (B[m[1;33;40mAuto reinstalling previously detected Xcache
    (B[m
    Xcache reinstall - Would you like to continue? [y/n] n
    

    By answering no to Xcache reinstall, you aborted the rest of the PHP upgrade routine which installs/reinstalls other PHP extensions - I'd consider this a bug as it should only continue. Probably because Xcache hasn't been tested by me in ages as it's slower than Zend Cache. So will have to look at this. Edit: updated 123.09beta01 to fix xcache reinstall routine so it doesn't abort when answering no to reinstall of xcache.

    Why you using xcache and not zend opcache ? zend opcache is faster and compatible with PHP 7.2 as well versus Xcache seems still not compatible XCache ?. I'd answer yes to to question for Zend Opcache install
     
    Last edited: Sep 4, 2018
  12. Marcos

    Marcos New Member

    11
    4
    3
    Sep 3, 2018
    Ratings:
    +4
    Local Time:
    1:21 AM
    1.17.5
    MariaDB 10.3
    Now it worked!!
     
  13. eva2000

    eva2000 Administrator Staff Member

    53,535
    12,134
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,677
    Local Time:
    2:21 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Glad to hear :)