We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33210
    • 4 Posts
    Hi there,

    I found a problem in the way modx is downloading files while using the package manager. And now I would like to know if this is a server-configuration issue.

    On my server ’allow_url_fopen’ is set to false.

    So, looking in the code I found that that modx is trying to download files using cURL.
    (modTransportPackage.transferPackage line 258)

    This is working but after the file is written to disk. MODx fails to open that file.
    (xPDOZip.__construct line 66, ZipArchive.open returns 19 (ZIPARCHIVE::ER_NOZIP))

    After some trying I found (using Live HTTPS headers and downloading some package in FF) that the MODx server answers to the download request with:

    Content-Encoding: gzip
    


    So I added this to the cURL config:

    curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
    


    And now the file is readable as a zip archive.

    So again, is this some configuration issue or something else?


    Best regards!
      • 34162
      • 1 Posts
      Thanks for the tip, helped a lot, was able to upgrade my old sites and their packages to newest ones before going for the core upgrade.

      Before finding your post, banged my head against the wall for nice couple of hours.

      Thank you
        • 48645
        • 7 Posts
        Hello!
        In what file you added
        curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); huh