harishanchu / Laravel-FTP

A simple Laravel 4/5/6/7 ftp service provider with basic ftp methods.
220 stars 87 forks source link

Documentation #4

Closed Exadra37 closed 10 years ago

Exadra37 commented 10 years ago

When we try to override the config on the fly, doing as stated in the documantation will throw an exception: Error in ftp: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known

The problem is that we can't specify the name of the connection 'key', because if you do so the class FtpManager will end up with a empty config, therefore in class Ftp will not be possible to make the connection.

This is wrong and will not work, as it is in documentation: Config::set('ftp::connections.key', array( 'host' => '', 'username' => '', 'password' => '', 'passive' => false, ));

This will work: Config::set('ftp::connections', array( 'key' => array( 'host' => '', 'username' => '', 'password' => '', 'passive' => false ), ));

Many thanks for this very useful library :)

harishanchu commented 10 years ago

Error in ftp: ftp_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known - this means web server can't find the FTP server you're talking about. Domain name doesn't exist, name resolution failed (DNS = dead). Please check your code/host name and make sure everything is correct.

To set dynamic ftp configurations, you should follow the method specified in the documentation. The problem with your suggestion is that, it will clear all the predefined ftp connection settings in the ftp configuration file(/app/config/packages/anchu/ftp/config.php).

I am closing this for now. Feel free to reopen if it didn't help you.

Exadra37 commented 10 years ago

I know what it means the error.

I think my post was very detailed.

As i said, inside of Class FtpManager you have the $config var empty when you use the method in documentation, therefore the Class Ftp will receive also a empty $config var and obviously you cannot resolve a hostname that is value is an empty string.

If you don't believe try it and make a var_dump inside of one of that classes.

If it may interest i am using this in Laravel 4.1 in a Artisan Command.