Learn about Centmin Mod LEMP Stack today
Register Now

How to install PHP 8?

Discussion in 'Install & Upgrades or Pre-Install Questions' started by duderuud, Dec 5, 2020.

  1. duderuud

    duderuud Premium Member Premium Member

    221
    78
    28
    Dec 5, 2020
    The Netherlands
    Ratings:
    +166
    Local Time:
    11:57 PM
    1.25 x
    10.6
    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS 7 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: i.e. 1.19.5
    • PHP Version Installed: 7.4.13
    • When was last time updated Centmin Mod code base ? : latest version
    Want to try PHP 8 but how can I install that?

     
  2. eva2000

    eva2000 Administrator Staff Member

    53,229
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    7:57 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Just like any other PHP version example for PHP 7.3 install at PHP 7.4.11, 7.3.23, 7.2.34 Security Updates + Backported PHP 7.1.33, 7.0.33 & 5.6.40 via centmin.sh menu option 5 Centmin Mod Menu - CentminMod.com LEMP Nginx web stack for CentOS

    Run cmupdate command to ensure latest 123.09beta01 code is on your server and then run centmin.sh menu option 5 specify the exact PHP version you want at prompt i.e. 8.0.0 and then answer yes to Zend Opcache install and hit continue and wait while PHP 8.0.0 is compiled then exit centmin.sh menu via option 24
     
  3. duderuud

    duderuud Premium Member Premium Member

    221
    78
    28
    Dec 5, 2020
    The Netherlands
    Ratings:
    +166
    Local Time:
    11:57 PM
    1.25 x
    10.6
    Ah, that explains it. I tried 8 and 8.0...not 8.0.0 :)

    Thanks!
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,229
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    7:57 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yeah it's the exact version you want to upgrade or downgrade or recompile for :)
     
  5. duderuud

    duderuud Premium Member Premium Member

    221
    78
    28
    Dec 5, 2020
    The Netherlands
    Ratings:
    +166
    Local Time:
    11:57 PM
    1.25 x
    10.6
    Of course it's better to wait for 8.0.1 or even 8.1 but hey...wanna test stuff :)
     
  6. duderuud

    duderuud Premium Member Premium Member

    221
    78
    28
    Dec 5, 2020
    The Netherlands
    Ratings:
    +166
    Local Time:
    11:57 PM
    1.25 x
    10.6
    Xenforo (basic install with only a few addons) seems to run fine on 8
     
  7. eva2000

    eva2000 Administrator Staff Member

    53,229
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    7:57 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    I take it you're running Xenforo 2.2.2 with PHP 8 support?
     
  8. duderuud

    duderuud Premium Member Premium Member

    221
    78
    28
    Dec 5, 2020
    The Netherlands
    Ratings:
    +166
    Local Time:
    11:57 PM
    1.25 x
    10.6
    Indeed
     
  9. tininho

    tininho Active Member

    182
    44
    28
    May 22, 2019
    eu
    Ratings:
    +135
    Local Time:
    12:57 AM
    A vanilla WP 5.6 site that works with PHP 7.4.x does not work with PHP 8.0. Throws a bad gateway 502 error after PHP 8 upgrade

    Code:
    real    0m21.585s
    user    0m21.455s
    sys    0m0.022s
    ./sapi/cgi/php-cgi -T10 /svr-setup/php_pgo_training_scripts/index.php
    PHP Fatal error:  Uncaught ArgumentCountError: parse_str() expects exactly 2 arguments, 1 given in /svr-setup/php_pgo_training_scripts/standard_calls.php:107
    Stack trace:
    #0 /svr-setup/php_pgo_training_scripts/standard_calls.php(107): parse_str()
    #1 /svr-setup/php_pgo_training_scripts/standard_calls.php(70): run_standard_calls()
    #2 /svr-setup/php_pgo_training_scripts/index.php(84): run_standard()
    #3 {main}
      thrown in /svr-setup/php_pgo_training_scripts/standard_calls.php on line 107
    Status: 500 Internal Server Error
    Content-type: text/html; charset=UTF-8
    So PGO is not working with PHP 8? Related to JIT? There are more errors related to /svr-setup/php_pgo_training_scripts/ folder.

    Code:
    WPPLUGINS_ALL='n'
    
    VHOSTCTRL_CLOUDFLAREINC='y'
    CLOUDFLARE_ZLIB='y'
    
    ENABLEMOTD_CSFMSG='n'         # motd banner csf message alert disaply
    ENABLEMOTD_LINKSMSG='n'       # motd centminmod.com links bookmark alert display
    DISABLE_IPVSIX='y'
    
    AUTOTUNE_CLIENTMAXBODY='y'
    
    ## FOR PHP 7.4+
    FPM_WAKEUP_PATCH='y'
    
    AUTODETECPHP_OVERRIDE='y'
     
    ##For Linux Kernel  > 5.1.x
    NGINX_IOURING_PATCH_BETA='y'
    
    ##Upgrading NGINX. Disable, if custom configs
    NGINX_ALLOWOVERRIDE='y'
    
    #NGINX_FATLTO_OBJECTS='n'        # enable -ffat-lto-objects flag for nginx builds - much slower compile times
    #NGINX_NOFATLTO_OBJECTS='n'      # enable -fno-fat-lto-objects flag for nginx builds - much slower compile times
    
    NGINX_DYNAMICTLS='y'
    NGINX_SSLCACHE_ALLOWOVERRIDE='y'  
    NGXDYNAMIC_BROTLI='y'
    NGINX_LIBBROTLI='y'
    AUTOHARDTUNE_NGINXBACKLOG='y'
    
    MARIADB_INSTALLTENFOUR='y'
    SET_DEFAULT_MYSQLCHARSET='utf8mb4'
     
    LETSENCRYPT_DETECT='y'
    DUALCERTS='y'
    NGINX_HPACK='y'
    
    GCC_FALIGN_FUNCTION='y'
    
    LIBRESSL_SWITCH='n'
    CLANG='n'
    DEVTOOLSETSIX='n'
    DEVTOOLSETSEVEN='n'
    DEVTOOLSETEIGHT='n'
    DEVTOOLSETNINE='y'
    NGINX_DEVTOOLSETGCC='y'
    GENERAL_DEVTOOLSETGCC='y'
    CRYPTO_DEVTOOLSETGCC='y'
     
    CUSTOM_CURLRPM='y'
    CUSTOM_CURLRPMVER='7.69.0'       # custom curl/libcurl version
    
    PHP_PGO='y'
    PHP_PGO_ALWAYS='y'
    
    
    PHPPGO_INDEXPATH='/home/nginx/domains/XX/public/index.php'
    #PHPPGO_INDEXPATH_TWO='/home/nginx/domains/XX/public/index.php'
    
    PHP_TUNING='y'
    
    PHP_BROTLI='y'
    PHP_LZFOUR='y'
    PHP_LZF='y'
    PHP_ZSTD='y'
     
    ZSTD_LOGROTATE_NGINX='y'
    ZSTD_LOGROTATE_PHPFPM='y'
     
    MARCH_TARGETNATIVE_ALWAYS='y'
    
    PHPFINFO='y'
    WP_FASTCGI_CACHE='y'
    LETSENCRYPT_DETECT='y'
    PHP_UPDATEMAINTENANCE='y'
    MARIADB_UPDATEMAINTENANCE='y'
    
    SSL_PROTOCOL_MODERN='y'
    #NGINX_MODSECURITY_MAXMIND='y'
    #NGINX_MODSECURITY='y'
    
    WPCLI_CE_QUERYSTRING_INCLUDED='y'
    
    NGINX_STAPLE_CACHE_OVERRIDE='y'
    NGINX_STAPLE_CACHE_TTL='86400'
    
    CF_DNSAPI='y'
    
    
     
  10. eva2000

    eva2000 Administrator Staff Member

    53,229
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    7:57 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    looks like PGO training PHP script itself isn't compatible with PHP 8
    /svr-setup/php_pgo_training_scripts/index.php related to line 107 of standard_calls.php If anyone has PHP / PHP 8 know how and can help with updating centminmod/php_pgo_training_scripts it would be nice too :)

    actually that line is for PHP 7.1 change PHP: parse_str - Manual
    PHP: Backward Incompatible Changes - Manual
    Though this error doesn't prevent PGO optimizations given the PHP 8 PGO performance boosts I have tested.
     
    Last edited: Dec 12, 2020
  11. eva2000

    eva2000 Administrator Staff Member

    53,229
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    7:57 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    That is probably a separate issue from PGO though. If you disable PHP_PGO='n' and compile PHP 8.0.0, do you get 502 errors ?

    check out linked thread at Wordpress - Wordpress 5.6 Released Test You Upgrades First warning Wordpress 5.6 can break a lot in general due to changes in jQuery etc
     
  12. eva2000

    eva2000 Administrator Staff Member

    53,229
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    7:57 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Just made an update to Centmin Mod 123.09beta01 to fix that error for PHP 8.x based PGO installs
     
  13. tininho

    tininho Active Member

    182
    44
    28
    May 22, 2019
    eu
    Ratings:
    +135
    Local Time:
    12:57 AM
    I never looked into this more thoroughly, yet. I will toy with Zen3 and Centminmod on the coming days :)
     
  14. Mr. Jinx

    Mr. Jinx New Member

    29
    8
    3
    Apr 18, 2021
    Ratings:
    +15
    Local Time:
    11:57 PM
    Just installed PHP 8.0.5 on a 1 GB (test) VPS.
    Oof, that was not easy but it worked in the end :)

    The compilation crashed on apprentice.lo because of too little memory, so I doubled the swap file from 1 GB to 2 GB.
    With PGO enabled, total compile time was a whopping 45 minutes!
     
  15. duderuud

    duderuud Premium Member Premium Member

    221
    78
    28
    Dec 5, 2020
    The Netherlands
    Ratings:
    +166
    Local Time:
    11:57 PM
    1.25 x
    10.6
    Recently switched to PHP 8 on our live XF server without any issues.
     
  16. Mr. Jinx

    Mr. Jinx New Member

    29
    8
    3
    Apr 18, 2021
    Ratings:
    +15
    Local Time:
    11:57 PM
    Good to hear, that's what I am about to do. The test server is a bit low on resources, but should be fine for the live site running with much more resources.
     
  17. eva2000

    eva2000 Administrator Staff Member

    53,229
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    7:57 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Great to hear, those PGO does require more memory and more time to compile as PGO has to compile PHP twice to do profile guided optimization training. So if you have a slow cpu and low clocked cpu and less memory, it can take a while :)

    Good to hear :D