2

In my Drupal 8 project, I want to use the Flysystem module in order to manage files directly on a remote FTP server.

I installed the module and all external libraries via composer. I also edited settings.php and added the FTP schema based on the README file.

Everything seems to be right, but in the status report, I always see a "Driver is missing" error message.

I don't know what wrong. I searched the Drupal website and module issue page, but I found no solution or guidelines for FTP.

Does any body know how can we use the module with FTP?

1 Answer 1

3

Requirements

If you look at the flysystem.install file (it's currently the same whether you installed 2.0.x or 8.x-1.x), you can see the code used for flysystem_requirements().

The general structure of the checking is as follows:

  1. Validate the schemes in settings.php
  2. Make sure the dependencies are installed:
    a) League\Flysystem\Filesystem
    b) League\Flysystem\Replicate\ReplicateAdapter
    c) Twistor\FlysystemStreamWrapper
  3. Then, it calls ensure() on the plugin for each scheme, and makes sure the plugin can be instantiated.

This 3rd step calls this code (src/FlysystemFactory.php):

  public function getPlugin($scheme) {
    if (!isset($this->plugins[$scheme])) {
      $settings = $this->getSettings($scheme);

      $this->plugins[$scheme] = $this->pluginManager->createInstance($settings['driver'], $settings['config']);
    }

    return $this->plugins[$scheme];
  }

It also provides the defaults:

  protected $defaults = [
    'driver' => '',
    'config' => [],
    'replicate' => FALSE,
    'cache' => FALSE,
    'name' => '',
    'description' => '',
  ];

Given the above information, your plugin and schema should have declared your driver with 'driver' => 'ftp'.

Solution?

Also, on the main module page under "supported adapters", it says:

Ftp (Requires the ftp extension)

Though I'm not sure, since it doesn't link to another module like the other adapters, I think it means the PHP extension. Try installing the ftp PHP extension. Here's the page for setup instructions.

9
  • Thanks a lot. you are right. I enabled ftp extension in my php ini and it worked. but speed is very low. I uploaded 5KB image and image more than 1 minute took time to be loaded. Now I want to test it via online server but I am not sure weather FTP extension is enabled on my shared hosting or not!?
    – Mehrdad201
    Dec 17, 2020 at 22:34
  • You will need to do some further research, or ask your hosting provider. If I have answered your current question, consider marking the answer as "accepted".
    – mbomb007
    Dec 17, 2020 at 22:57
  • tested. it works on online share hosting. but there is 2 important problem. 1- speed is still very low but doesn't matter. 2 and big problem, as you know Drupal 8 by default save files in folders named Year-Month for example 2020-12. problem is when this folder is created before in path, new image can not be uploaded in it. I checked recent log messages and I found this error: The upload directory 2020-12 for the file field field_image could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.
    – Mehrdad201
    Dec 17, 2020 at 23:21
  • @Mehrdad201 share hosting that's why it's slow. new image can not be uploaded in it folder doesn't have write permission and/or the correct group/owner.
    – No Sssweat
    Dec 18, 2020 at 0:49
  • @No Sssweat I tested it. I set permission 777 but it doesn't work. you know, for the first time, it folder doesn't exist, it works. it creates a folder on remote ftp and put file in it. but for the next file in same directory, it doesn't work. it seems it can't detect the folder is created and doesn't need to create it again. I am searching for it. I found people had the same problem with S3 amazon type of flysystem.
    – Mehrdad201
    Dec 18, 2020 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.