Want more timely Centmin Mod News Updates?
Become a Member

Beta Branch re-enable PHP local download mirror fallback in 123.09beta01

Discussion in 'Centmin Mod Github Commits' started by eva2000, May 6, 2021.

  1. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,630
    Local Time:
    10:35 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    re-enable PHP local download mirror fallback in 123.09beta01

    - php.net downloads switched to a CDN method instead of a mirror method years ago so Centmin Mod local mirror fallback routine was disabled as it was no longer needed as a CDN would be reliable enough to serve PHP download files
    - unfortunately it seems php.net CDN downloads are having issues with 503 service unavailable messages on some downloads for some of their CDN edge servers only and not all Install - Nginx - PHP-FPM - Nginx and PHP-FPM failed to install. Interesting part is the centmin mod internal PHP download curl check for 404/503 status is returning 200 status but the actual php.net download is coming back 503 when downloaded. This suggests the initial curl check is hitting one CDN edge server but the download maybe hitting another CDN edge server which returns a 503 error. Thus added an additional check and re-enabled the fallback local Centmin Mod mirror download of PHP.net version files. This local Centmin Mod mirror isn't frequently updated or consistent - maybe around 0-10 days after a PHP new version release. But with the fallback being re-enabled I'll update the local mirror more frequently closer to a new PHP version release. Thanks to Cloudflare Transform rules Dynamic URL Rewriting at the edge with Cloudflare it was easier to make the local mirror url paths more closely match the PHP.net official download paths without having to change anything on the backend Nginx/storage path wise :)
    - to update 123.09beta01, run cmupdate command before running centmin.sh menu option 5 for PHP upgrades/recompiles

    example centmin.sh menu option 5 PHP upgrade/recompile output with the retrying local mirror download routine where first download via php.net CDN gives 503 and retrying uses local mirror


    Code (Text):
    *************************************************
    * Upgrading PHP
    *************************************************
    SG server detected
    
    HTTP/1.1 200 OK
    1
    0
    Initializing download: https://www.php.net/distributions/php-7.3.28.tar.gz
    HTTP/1.1 503 Service Temporarily Unavailable
    
    retrying local mirror download
    
    Initializing download: https://centminmod.com/distributions/php-7.3.28.tar.gz
    File size: 19677493 bytes
    Opening output file php-7.3.28.tar.gz
    Starting download


    Continue reading...

    123.09beta01 branch
     
  2. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,630
    Local Time:
    10:35 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Must be some kind of 503 maintenance thing as now other servers are getting 503 for PHP.net downloads. This is a Canadian server and same 503 but with above updated local fallback mirror it's download again via local mirror :)

    Code (Text):
    CA server detected
                                                                                  
    HTTP/2 200 
    1
    0
    Initializing download: https://www.php.net/distributions/php-7.3.28.tar.xz
    HTTP/1.1 503 Service Temporarily Unavailable
    
    retrying local mirror download
    
    Initializing download: https://centminmod.com/distributions/php-7.3.28.tar.xz
    File size: 12139380 bytes
    Opening output file php-7.3.28.tar.xz
    Starting download
    
     
  3. DaB

    DaB Member

    45
    5
    8
    Aug 10, 2016
    Ratings:
    +6
    Local Time:
    1:35 AM
    Current
    Current
    Can confirm this works now.
     
  4. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,630
    Local Time:
    10:35 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    You had this issue with a PHP upgrade or initial Centmin Mod install's PHP install ?

    Looks like maybe something changed in PHP.net's CDN setup as just testing a fresh Centmin Mod 123.09beta01 PHP 7.4 default install and the download part gives 503 service unavailable and fell back to local Centmin Mod mirror too. Maybe PHP.net CDN doesn't like me using axel download accelerator which opens up multiple connections to download the PHP file faster?
    Code (Text):
    US server detected
    HTTP/1.1 404 Not Found
    HTTP/1.1 200 OK
    0
    0
    Download php-7.4.19.tar.gz ...
    axel -4 https://www.php.net/distributions/php-7.4.19.tar.gz -o php-7.4.19.tar.gz
    Initializing download: https://www.php.net/distributions/php-7.4.19.tar.gz
    HTTP/1.1 503 Service Temporarily Unavailable
    
    retrying local mirror download
    
    axel -4 https://centminmod.com/distributions/php-7.4.19.tar.gz -o php-7.4.19.tar.gz
    Initializing download: https://centminmod.com/distributions/php-7.4.19.tar.gz
    File size: 16601425 bytes
    Opening output file php-7.4.19.tar.gz
    Starting download
    

    Seem implementing this workaround ~26hrs ago, Cloudflare is reporting local PHP mirror download count of 690 downloads.

    upload_2021-5-7_15-27-9.png

    Top 15 downloaded PHP versions from local Centmin Mod mirror

    upload_2021-5-7_15-27-54.png

    edit: does look like PHP.net CDN changed their policy on multi-threaded downloads of their files i.e. via axel
    Code (Text):
    axel -4 https://www.php.net/distributions/php-7.4.19.tar.gz -o php-7.4.19.tar.gz
    Initializing download: https://www.php.net/distributions/php-7.4.19.tar.gz
    HTTP/1.1 503 Service Temporarily Unavailable
    
     
    Last edited: May 7, 2021
  5. eva2000

    eva2000 Administrator Staff Member

    47,294
    10,705
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,630
    Local Time:
    10:35 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x