Issues with FiledownloadR after site migration

I’ve just moved my website to a different host, and in the most part everything went smoothly. However I am having issues with FiledownloadR. It doesn’t seem to be able to populate the placeholders.

If I try to use the &toArray option I don’t get any output at all either.

I have tried removing and reinstalling the extra (even removing the database tables) but no matter what I do it doesn’t seem to work. It does throw up warnings in the installation:

PHP warning: file_get_contents(***/core/components/filedownloadr/vendor/composer/installed.php): failed to open stream: No such file or directory
PHP warning: file_get_contents(***/core/components/filedownloadr/vendor/composer/InstalledVersions.php): failed to open stream: No such file or directory
PHP warning: file_get_contents(***/core/components/filedownloadr/vendor/composer/autoload_namespaces.php): failed to open stream: No such file or directory
PHP warning: file_get_contents(***/core/components/filedownloadr/vendor/composer/autoload_psr4.php): failed to open stream: No such file or directory
PHP warning: file_get_contents(***/core/components/filedownloadr/vendor/composer/autoload_classmap.php): failed to open stream: No such file or directory
PHP warning: file_get_contents(***/core/components/filedownloadr/vendor/composer/autoload_static.php): failed to open stream: No such file or directory
PHP warning: file_get_contents(***/core/components/filedownloadr/vendor/composer/platform_check.php): failed to open stream: No such file or directory
PHP warning: file_get_contents(***/core/components/filedownloadr/vendor/autoload.php): failed to open stream: No such file or directory
PHP warning: file_get_contents(***/core/components/filedownloadr/vendor/composer/autoload_real.php): failed to open stream: No such file or directory
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update `.
type or paste code here

Could these warnings be part of the issue?

I also get the following in the error log:

[2025-04-16 17:06:05] (ERROR @ ***/core/components/filedownloadr/src/Snippets/FileDownloadLinkSnippet.php : 100) PHP warning: Invalid argument supplied for foreach()

Any insight into what I might need to do would be greatly appreciated.

Probably not.
Do these files now exist?


Unfortunately this warning is quite vague.


Have you considered that the reason for the issue might not be the extra itself, but something that is different in this new hosting environment?

Did you check that the file permissions (for the file in question) are correct?
Or maybe the new host is missing a (necessary) PHP extension.

Thanks @halftrainedharry

The permissions are good on the file (I’ve checked both in the file browser and by directly inputting the url into the address bar).

Any ideas about how I would go about checking to see if there is a missing extension. I wouldn’t even know how to start to check, and what is needed and what isn’t.

Yes those files that were referenced in the warning now exist, but the warnings still come up if I attempt a reinstall.

Let’s maybe start with the basics:

  • What version of PHP are you using?
  • What version of MODX are you using? Did you rerun the setup after the migration? (Does the rest of your site work normally?)
  • What version of FileDownloadR are you using? Is this the same version that you used on your old setup or did it change?
  • What is the exact snippet tag ([[!FileDownloadLink...]]) that you use?

During the installation of the extra, composer runs to install dependencies. If the dependencies are available (paths core/components/filedownloadr/vendor/ip2location/ipinfodb-php and core/components/filedownloadr/vendor/ralouphie/mimey) then I don’t think this is the cause of the problem.


The documentation has a list of required PHP extensions. (Not sure if this list is complete.)

You could use phpinfo() to see what’s installed. In the MODX manager go to :gear: → “Reports” → “System Info” and click the “View” link in the row “phpinfo():”.

Hmmm. It looks like it might be something deeper than that, I’ve just checked another site that I set up on the same host, and FileDownloadR was working perfectly there, but it’s stopped working on that site now also, so it must be something with the hosting service rather than my specific sites set up.
Although, I’ve no idea what could have changed to cause it to stop working. At this point I think I will have to find an alternative.

There is a known bug. you can try this fix in core/components/filedownloadr/src/FileDownloadR.php

/**
     * Set the direct link to the file path.
     *
     * @param string $filePath absolute file path
     * @return array the download link and the javascript's attribute
     */
    private function directLinkFileDownload($filePath)
    {
        $link = [];
        $link['url'] = '';
        if ($this->getOption('noDownload')) {
            $link['url'] = $filePath;
        } else {
            $corePath = str_replace('/', $this->getOption('directorySeparator'), MODX_CORE_PATH);
            // don't work in the MODX core path
            if (strpos($filePath, $corePath) === 0) {
                return [];
            }
            if (empty($this->mediaSource)) {
                // the file path has to start with the MODX base path
                $basePath = str_replace('/', $this->getOption('directorySeparator'), MODX_BASE_PATH);
                if (strpos($filePath, $basePath) === 0) {
                    $fileUrl = str_replace($this->getOption('directorySeparator'), '/', $filePath);
                    $fileUrl = MODX_BASE_URL . substr($fileUrl, strlen($basePath));
                    $fileUrl = ltrim($fileUrl, '/');
                    $link['url'] = MODX_URL_SCHEME . MODX_HTTP_HOST . '/' . $fileUrl;
                } else {
                    return [];
                }
            } else {
                $link['url'] = $this->mediaSource->getObjectUrl($filePath);
            }
        }
        $link['hash'] = '';
        return $link;
    } 

I had a similar thing happen with a different extra and was getting the same “lock file is not up to date” error. The problem was that PHP was updated on the server, and they uninstalled the “fileinfo” extension. Once that was turned back on, I reinstalled the extra and that fixed the problem. Contact your host and make sure fileinfo is enabled, or turn it on yourself through cPanel if that is available.