Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ftp_rawlist(): php_connect_nonb() failed: Operation now in progress (115) #119

Open
arthur798 opened this issue Feb 10, 2021 · 3 comments
Open

Comments

@arthur798
Copy link

So within laravel I am trying to use this package in order to connect to remote host and send or even list files.

So in my config I have:

        'ftp' => [
            'driver' => 'ftp',
            'host' => 'host',
            'username' => 'username',
            'password' => 'password',
            'ssl' => false,
            'passive' => 'false', 
            'ignorePassiveAddress' => true,
            'port' => 21
        ],

Now I have also tried native solution like:

            $host = config('filesystems.disks.ftp.host');
            $user = config('filesystems.disks.ftp.username');
            $password = config('filesystems.disks.ftp.password');
            $ftpConn = ftp_connect($host);
            $login = ftp_login($ftpConn, $user, $password);
            //
            //Enable PASV ( Note: must be done after ftp_login() )
            //
            $mode = ftp_pasv($ftpConn, TRUE);
            // check connection

            if ( (!$ftpConn) || (!$login) || (!$mode) ) {
                echo 'FTP connection has failed! Attempted to connect to ' . $host . ' for user ' . $user . '.';
            } else {
                echo 'FTP connection was a success.';
                $directory = ftp_nlist($ftpConn, '.');
                dd('line');
                echo '<pre>' . print_r($directory, true) . '</pre>';
            }
            ftp_close($ftpConn);

However in both cases I get same error, ftp_rawlist(): php_connect_nonb() failed: Operation now in progress (115) pointing at line lluminate\Foundation\Bootstrap\HandleExceptions::handleError vendor/league/flysystem/src/Adapter/Ftp.php:570 I have tried it via Filezilla and it works fine, the php code runs inside ubuntu docker image. Is there anything I am missing here?

@skorpions2000
Copy link

maybe add in vendor/league/flysystem/src/Adapter/Ftp.php

        if (defined('FTP_USEPASVADDRESS')){
            ftp_set_option($this->connection, FTP_USEPASVADDRESS, false);
        }

before

        if ( ! ftp_pasv($this->connection, $this->passive)) {
            throw new ConnectionRuntimeException(
                'Could not set passive mode for connection: ' . $this->getHost() . '::' . $this->getPort()
            );
        }

@sdamediadev
Copy link

is this solution working ?

@craiglondon
Copy link

The issue above is related to FTP connections, not SFTP connections, this issue should be closed or moved to https://github.com/thephpleague/flysystem-ftp, most likely the issue is misconfiguration of the parameters, "passive" should be true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants