Learn about Centmin Mod LEMP Stack today
Register Now

[Solved] Argon2i Support in PHP 7.2.3 (Beta Build)

Discussion in 'Bug Reports' started by noopy, Mar 17, 2018.

  1. noopy

    noopy New Member

    9
    3
    3
    Mar 17, 2018
    Ratings:
    +4
    Local Time:
    4:02 AM
    Hello,
    • CentOS Version: CentOS 7 64 bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.13.9
    • PHP Version Installed: 7.2.3
    • MariaDB MySQL Version Installed: 10.1.31
    • When was last time updated Centmin Mod code base ? : newest (beta) build/recent.
    • Persistent Config: just letsencrypt
    Although, I am building Centminmod with PHP v7.2+ it doesn't seem to want to build argon2i support. I thought PHP 7.2 by default comes compiled with argon2i? How can I go about building it with such support?

    Thank you so much for your time/effort. I appreciate it!
     
  2. eva2000

    eva2000 Administrator Staff Member

    36,023
    7,901
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,183
    Local Time:
    6:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Hi yes 123.09beta01's PHP 7.2 intends to have argon2 support just that it's still work in progress as it's failing to compile properly for me so isn't installed right now :(

    Might have to revisit it as it's been a few months since I last tried was back in Nov 2017 and seems issue was with required dependency for libzip failing php 7.2.0 ga stable errors 30/11/17

    edit: just tried again still tripping up and failing to compile
    Code (Text):
    checking libzip... yes
    checking for the location of zlib... /usr/local/zlib-cf
    checking for pkg-config... (cached) /bin/pkg-config
    checking for libzip... from pkgconfig: version 1.5.0 found in /usr/lib64
    checking for zip_open in -lzip... yes
    checking for zip_file_set_encryption in -lzip... yes
    checking for zip_libzip_version in -lzip... yes
    checking stdbool.h usability... yes
    checking stdbool.h presence... yes
    checking for stdbool.h... yes
    checking fts.h usability... yes
    checking fts.h presence... yes
    checking for fts.h... yes
    checking for int8_t... (cached) yes
    checking for int16_t... (cached) yes
    checking for int32_t... (cached) yes
    checking for int64_t... (cached) yes
    checking for uint8_t... (cached) yes
    checking for uint16_t... (cached) yes
    checking for uint32_t... (cached) yes
    checking for uint64_t... (cached) yes
    checking for ssize_t... yes
    checking size of short... (cached) 2
    checking size of int... (cached) 4
    checking size of long... (cached) 8
    checking size of long long... (cached) 8
    checking size of off_t... 0
    configure: error: off_t undefined; check your library configuration
    

    will have to investigate but looks like i am not the only person with the issue PHP :: Bug #73943 :: Problem when configuring with zip support

     
    • Like Like x 1
  3. eva2000

    eva2000 Administrator Staff Member

    36,023
    7,901
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,183
    Local Time:
    6:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    ah think I found the solution to getting PHP 7.2 with libzip + libsodium + argon2 to compile. Testing it out right now :D

    Updated 123.09beta01 with fixed routine Beta Branch - update PHP 7.2 libzip, libsodium & argon2 route

    Code (Text):
    checking for Argon2 support... yes
    checking for Argon2 library... found in /usr/local
    checking for argon2_hash in -largon2... yes
    checking for argon2id_hash_raw in -largon2... yes
    

    Code (Text):
    php --ri sodium
    sodium
    
    sodium support => enabled
    libsodium headers version => 1.0.16
    libsodium library version => 1.0.16

    Code (Text):
    php --ri zip
    zip
    
    Zip => enabled
    Zip version => 1.15.2
    Libzip headers version => 1.5.0
    Libzip library version => 1.5.0
    

    Code (Text):
    ldd $(which php) | grep zip
            libzip.so.5 => /usr/local/lib64/libzip.so.5 (0x00007f586526e000)
    
     
    Last edited: Mar 17, 2018
    • Like Like x 2
    • Winner Winner x 1
  4. eva2000

    eva2000 Administrator Staff Member

    36,023
    7,901
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,183
    Local Time:
    6:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    FYI, PHP 7.2 has support for argon2 but it's disabled by default due to dependencies not being available in distro repositories so they leave it to end users like Centmin Mod (me) to actually enable support for libsodium and argon2 which I have done now in 123.09beta01 :D
     
    • Like Like x 1
  5. noopy

    noopy New Member

    9
    3
    3
    Mar 17, 2018
    Ratings:
    +4
    Local Time:
    4:02 AM
    Awesome, thank you - but still running into an issue. For some reason, PHP (7.2.0/7.2.2/7.2.3) doesn't want to be built with argon2(i).

    Code:
      --libs              [-lcrypt  -lc-client  -lz -lexslt -ltidy -lresolv -lcrypt -ledit -lncurses -laspell -lpspell -lrt -lldap -llber -lstdc++ -lcrypt -lpam -lgmp -lX11 -lXpm -lpng -lz -ljpeg -lwebp -lenchant -lbz2 -lz -lrt -lm -ldl -lnsl  -lxml2 -lz -lm -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lcurl -lxml2 -lz -lm -ldl -lssl -lcrypto -lfreetype -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -ldl -lm -licui18n -licuuc -licudata -ldl -lm -licuio -lxml2 -lz -lm -ldl -lnetsnmp -lssl -lssl -lcrypto -lm -lxml2 -lz -lm -ldl -lcrypt -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl-lxml2 -lz -lm -ldl -lxslt -lxml2 -lz -ldl -lm -lssl -lcrypto -lcrypt ]
    Using beta build 123.09beta01. And added PHP_LIBZIP='y' to custom_config file. Not sure what the problem is.

    Again, thank you for your help!
     
  6. eva2000

    eva2000 Administrator Staff Member

    36,023
    7,901
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,183
    Local Time:
    6:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Did you update 123.09beta01 code on your server first ? Running centmin.sh menu option 23 submenu option 2 and exiting centmin.sh and re-running centmin.sh or running cmupdate command

    Code (Text):
    cmupdate
    No local changes to save
    Updating e013b91..79da2ce
    Fast-forward
     centmin.sh                |  7 +++++--
     example/custom_config.inc |  6 ++++--
     inc/downloadlinks.inc     |  5 ++++-
     inc/libzip.inc            | 25 +++++++++++++++++++++++++
     inc/php_configure.inc     | 37 +++++++++++++++++++++++++++++++------
     5 files changed, 69 insertions(+), 11 deletions(-)
     create mode 100644 inc/libzip.inc
    


    then run centmin.sh menu option 5 to recompile PHP 7.2.3

    Upgrading Centmin Mod Code to Latest Version



    Getting Started Guide step 19 outlines also how to keep Centmin Mod code updated or how to switch version branches or you can run cmupdate command that was recently added.

    Centmin Mod LEMP stack's script code is constantly updated for improvements, bug fixes and security fixes so keeping the Centmin Mod code up to date is important. With Centmin Mod 1.2.3-eva2000.08) (123.08stable) and higher releases, a newly added centmin.sh menu option 23 allows much easier code updates and version branch swicthing via Git backed environment you can setup. For full details read the following links:
     
    • Like Like x 1
  7. noopy

    noopy New Member

    9
    3
    3
    Mar 17, 2018
    Ratings:
    +4
    Local Time:
    4:02 AM
    This never worked. Didn't want to bother you again and was waiting for another release. Gave it another try with PHP 7.2.5, with the same result. Argon support isn't being built no matter what I do.

    Fresh Centos 7 install, built using github, upgraded to php 7.2.5 (via the panel) with PHP_LIBZIP='y' in custom_config. Running 123.09beta01.

    Code:
    php -r 'print_r(get_defined_constants());' | grep -i argon
    Returns nothing.

    Code:
    PHP 7.2.5 (cli) (built: May 16 2018 01:53:08) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
        with Zend OPcache v7.2.5, Copyright (c) 1999-2018, by Zend Technologies
    Any suggestions? Did I miss a step in the build process?

    Thank you,
    Kevin
     
  8. eva2000

    eva2000 Administrator Staff Member

    36,023
    7,901
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,183
    Local Time:
    6:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Need php upgrade log. 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
     
    • Like Like x 1
  9. eva2000

    eva2000 Administrator Staff Member

    36,023
    7,901
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,183
    Local Time:
    6:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Just checked, looks like libzip fails to install due to missing cmake3 yum package so argon2 is disabled automatically
    Code (Text):
    libzip-1.5.0/src/ziptool.c
    inc/libzip.inc: line 21: cmake3: command not found
    make: *** No targets specified and no makefile found.  Stop.
    make: *** No rule to make target `install'.  Stop.

    Code (Text):
    ls -lah /usr/local/lib/libargon2.so
    lrwxrwxrwx 1 root root 14 May 16 05:40 /usr/local/lib/libargon2.so -> libargon2.so.1
    
    ls -lah /usr/local/lib/libsodium.so
    lrwxrwxrwx 1 root root 19 May 16 05:40 /usr/local/lib/libsodium.so -> libsodium.so.23.1.0
    
    ls -lah /usr/local/include/zip.h
    ls: cannot access /usr/local/include/zip.h: No such file or directory

    When either libsodium, libargon2 or libzip fail to install, centmin.sh auto disables argon2 in PHP 7.2 compiles
    Code (Text):
      if [[ ! -f /usr/local/lib/libargon2.so || ! -f /usr/local/lib/libsodium.so || ! -f /usr/local/include/zip.h ]]; then
        echo
        echo "disbable libzip, libsodium or libargon2 libraries"
        echo
        ARGONTWO_OPT=""
        LIBSODIUM_OPT=""
        LIBZIP_OPT=""
      fi

    This has been fixed in latest 123.09beta01 code now
    Code (Text):
    php -r 'print_r(get_defined_constants());' | grep -i argon
        [PASSWORD_ARGON2I] => 2
        [PASSWORD_ARGON2_DEFAULT_MEMORY_COST] => 1024
        [PASSWORD_ARGON2_DEFAULT_TIME_COST] => 2
        [PASSWORD_ARGON2_DEFAULT_THREADS] => 2
        [SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13] => 1
        [SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13] => 2
        [SODIUM_CRYPTO_PWHASH_STRPREFIX] => $argon2id$

    Code (Text):
    php --ri sodium
    
    sodium
    
    sodium support => enabled
    libsodium headers version => 1.0.16
    libsodium library version => 1.0.16

    So always good to report bugs ;) :)
     
    • Like Like x 1
  10. noopy

    noopy New Member

    9
    3
    3
    Mar 17, 2018
    Ratings:
    +4
    Local Time:
    4:02 AM
    !!! Awesome. Going to give it a try! Will report back in a bit. Thank you!
     
  11. noopy

    noopy New Member

    9
    3
    3
    Mar 17, 2018
    Ratings:
    +4
    Local Time:
    4:02 AM
    That's strange. Now PHP 7.2.(4/5) won't build/upgrade.
     
  12. eva2000

    eva2000 Administrator Staff Member

    36,023
    7,901
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,183
    Local Time:
    6:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  13. noopy

    noopy New Member

    9
    3
    3
    Mar 17, 2018
    Ratings:
    +4
    Local Time:
    4:02 AM
    Heya, okay: checking for localtime_r... yes checking for lockf... yes checking for lchown. - Pastebin.com

    Anything below 7.2.0 builds just fine.

    Thanks!

    Code:
    Success: PHP configure ok
     
    service php-fpm restart
    Gracefully shutting down php-fpm  done
    Starting php-fpm [16-May-2018 07:47:12] NOTICE: PHP message: PHP Warning:  Cannot load module 'redis' because required module 'igbinary' is not loaded in Unknown on line 0
     done
                   ____   _   _  ____       __  __         _
                  |  _ \ | | | ||  _ \  _  |  \/  |  __ _ | | __ ___
                  | |_) || |_| || |_) |(_) | |\/| | / _` || |/ // _ \
                  |  __/ |  _  ||  __/  _  | |  | || (_| ||   <|  __/
                  |_|    |_| |_||_|    (_) |_|  |_| \__,_||_|\_\\___|
     
    PHPMUVER = 7.2
    PHP_PGO = n
    make -j4
    make: *** No targets specified and no makefile found.  Stop.
     
    real    0m0.001s
    user    0m0.001s
    sys     0m0.000s
     
    Wed May 16 07:47:12 UTC 2018
    Error: 2, PHP make failed (123.09beta01.b021)
     
  14. eva2000

    eva2000 Administrator Staff Member

    36,023
    7,901
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,183
    Local Time:
    6:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    log shows
    Code (Text):
    checking size of long long... (cached) 8
    checking size of off_t... 0
    configure: error: off_t undefined; check your library configuration
    
    php_configure.inc make -j4
    make: *** No targets specified and no makefile found.  Stop.

    seems bug back in 7.2.0 Beta Branch - update PHP 7.2.0 GA compatibility in 123.09beta01

    and [Solved] - Argon2i Support in PHP 7.2.3 (Beta Build)

    what server type and cpu you using ? kvm, xen or openvz ? output of
    Code (Text):
    cat /proc/cpuinfo
    

    when was last time you updated 123.09beta01 ? try running cmupdate command, then re-run centmin.sh menu option 5
     
    • Like Like x 1
  15. eva2000

    eva2000 Administrator Staff Member

    36,023
    7,901
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,183
    Local Time:
    6:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    On my working PHP 7.2.5 argon2, libzip path = /usr/local
    Code (Text):
    cat /root/centminlogs/centminmod_123.09beta01.b021_160518-060119_php_upgrade.log | grep -A38 -n 'checking libzip'
    2216:checking libzip... yes
    2217-checking for the location of zlib... /usr
    2218-checking for pkg-config... (cached) /bin/pkg-config
    2219-checking for libzip... in default path: found in /usr/local
    2220-checking for zip_open in -lzip... yes
    2221-checking for zip_file_set_encryption in -lzip... yes
    2222-checking for zip_libzip_version in -lzip... yes
    2223-checking stdbool.h usability... yes
    2224-checking stdbool.h presence... yes
    2225-checking for stdbool.h... yes
    2226-checking fts.h usability... yes
    2227-checking fts.h presence... yes
    2228-checking for fts.h... yes
    2229-checking for int8_t... (cached) yes
    2230-checking for int16_t... (cached) yes
    2231-checking for int32_t... (cached) yes
    2232-checking for int64_t... (cached) yes
    2233-checking for uint8_t... (cached) yes
    2234-checking for uint16_t... (cached) yes
    2235-checking for uint32_t... (cached) yes
    2236-checking for uint64_t... (cached) yes
    2237-checking for ssize_t... yes
    2238-checking size of short... (cached) 2
    2239-checking size of int... (cached) 4
    2240-checking size of long... (cached) 8
    2241-checking size of long long... (cached) 8
    2242-checking size of off_t... 8
    2243-checking size of size_t... (cached) 8
    2244-checking for touch... /bin/touch
    2245-checking for unzip... /bin/unzip
    2246-checking for struct tm.tm_zone... (cached) yes
    2247-checking whether to enable mysqlnd... no
    2248-checking whether to disable compressed protocol support in mysqlnd... yes
    2249-checking for DSA_get_default_method in -lssl... yes
    2250-checking for X509_free in -lcrypto... yes
    2251-
    2252-Configuring PEAR
    2253-checking whether to install PEAR... yes

    on yours with issues, libzip path at /usr/lib64 which is older bugged 123.09beta01 routine for php 7.2 libzip compilation which suggests you didn't update to latest 123.09beta01 before re-launching centmin.sh ?
    Code (Text):
    checking libzip... yes
    checking for the location of zlib... /usr
    checking for pkg-config... (cached) /bin/pkg-config
    checking for libzip... from pkgconfig: version 1.5.1 found in /usr/lib64
    checking for zip_open in -lzip... yes
    checking for zip_file_set_encryption in -lzip... yes
    checking for zip_libzip_version in -lzip... yes
    checking stdbool.h usability... yes
    checking stdbool.h presence... yes
    checking for stdbool.h... yes
    checking fts.h usability... yes
    checking fts.h presence... yes
    checking for fts.h... yes
    checking for int8_t... (cached) yes
    checking for int16_t... (cached) yes
    checking for int32_t... (cached) yes
    checking for int64_t... (cached) yes
    checking for uint8_t... (cached) yes
    checking for uint16_t... (cached) yes
    checking for uint32_t... (cached) yes
    checking for uint64_t... (cached) yes
    checking for ssize_t... yes
    checking size of short... (cached) 2
    checking size of int... (cached) 4
    checking size of long... (cached) 8
    checking size of long long... (cached) 8
    checking size of off_t... 0
    configure: error: off_t undefined; check your library configuration
    
     
    • Like Like x 1
  16. noopy

    noopy New Member

    9
    3
    3
    Mar 17, 2018
    Ratings:
    +4
    Local Time:
    4:02 AM
    Thanks for the help.

    PHP 7.2.5 builds fine without the PHP_LIBZIP='y' flag. Oh well.

    It's running on openvz with a i7-4790K. Thank you for the help, but don't worry about it. I don't want to continue wasting your time. I'll just switch to another environment. You've been awesome.
     
    • Like Like x 1
  17. eva2000

    eva2000 Administrator Staff Member

    36,023
    7,901
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,183
    Local Time:
    6:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    one more thing you can try is removing libzip5 epel packages which is where php is reporting it's being found at /usr/lib64 first
    Code (Text):
    yum remove  libzip5 libzip5-devel --enablerepo=remi
    

    then re-running centmin.sh menu option 5 with PHP_LIBZIP='y' set in persistent config file /etc/centminmod/custom_config.inc
     
    • Like Like x 1
  18. noopy

    noopy New Member

    9
    3
    3
    Mar 17, 2018
    Ratings:
    +4
    Local Time:
    4:02 AM
    That worked perfect! Thank you very much!

    Just a note, when it prompts you if you want to download mods before the php upgrade, choose no. Else it'll re-install libzip5 and libzip5-devel. Thank you for getting this solved for me. I owe you a coffee!

    You do great work. Thanks again!
     
    • Informative Informative x 1
  19. eva2000

    eva2000 Administrator Staff Member

    36,023
    7,901
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,183
    Local Time:
    6:02 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Great to hear :)
    ah i might have left that in from previous attempt to setup argon2 in PHP 7.2 will check :)

    edit: just updated 123.09beta01 to remove unneeded libzip5 packages :)
     
    • Like Like x 1
..