Reputation: 549
I have downloaded ZF2 and I am making use of the nicolab/php-ftp-client library. This library works with our staging server but the issue is with the FTP Server configured locally. If I am using FileZille Client I can be able to enter my local File Server but not with PHP.
Below is a line I have in one of my test classes:
$handler = $this->ns->connect( '127.0.0.1:54218' )->login( '***', '***' );
Ofcourse that line works with the remote server but the local one.
PHPUnit gives me the following error:
$ vendor/bin/phpunit
PHPUnit 5.3.4 by Sebastian Bergmann and contributors.
.E 2 /(100%)
Time: 2.59 seconds, Memory: 8.25MB
There was 1 error:
1) ApplicationTest\Service\RemoteClientConnectionTest::testRemoteClientConnection
FtpClient\FtpException: Unable to connect
D:\web\www2\zend-file-manager\vendor\nicolab\
php-ftp-client\src\FtpClient\FtpClient.php:162
D:\web\www2\zend-file-manager\module\SparkleRemoteClient\test\
SparkleRemoteClientTest\Service\RemoteClientConnectionTest.php:22
FAILURES!
Tests: 2, Assertions: 1, Errors: 1.
Meanwhile FileZille Client gives me this output:
Status: Connecting to 127.0.0.1:54218...
Status: Connection established, waiting for welcome message...
Status: Logged in
Status: Retrieving directory listing...
Status: Directory listing of "/" successful
I am building a File Manager with Zend for our client and I need to have an FTP Server setup locally so that I do not run a risk of doing the wrong things with the staging and or live one.
Looking forward to hearing what I am missing here.
Upvotes: 0
Views: 630
Reputation: 5089
Please, check function definition
public function connect($host, $ssl = false, $port = 21, $timeout = 90)
So You need to use something like
$handler = $this->ns->connect('127.0.0.1',false,54218)->login( '***', '***' );
Upvotes: 2