1
votes

I'm trying to use the Laravel FTP Flysystem Adapter. Following the instructions on https://laravel.com/docs/5.2/filesystem I have added the following to my filesystems.php config file

'disks' => [
        'ftp' => [
            'driver'   => 'ftp',
            'host'     => 'ip_address',
            'username' => 'username',
            'password' => 'password',
            'root'     => '/home/username',
            'ssl'      => true,
        ],

    ],

When I'm running any command on the FTP disk like Storage::disk('ftp')->allDirectories('/home/username') I get the following error

PHP Fatal error: Uncaught exception 'ErrorException' with message 'fclose(): supplied resource is not a valid stream resource' in ../vendor/league/flysystem/src/Adapter/Ftp.php:455

I've tested the FTP server on an FTP client and all works fine.

1

1 Answers

0
votes

It turned out that vsftpd was "refusing to run with writable root inside chroot". Nice of PHP to show any kind of custom error.

Solution was to create a new directory within the user's home directory

mkdir /home/username/files

Change the ownership of that file to root

chown root:root /home/username

Make all necessary changes within the "files" subdirectory