Warning: ftp_login (): user cannot login, home directory unavailable

I am trying to connect and get the file from the server, but I got the following error:

Warning: ftp_login() : the user cannot log in, the home directory is unavailable.

 define('FTP_HOST', 'example.com'); define('FTP_USER', 'xxxx'); define('FTP_PASS', 'xxxx'); $conn_id = ftp_connect(FTP_HOST) or die("Couldn't connect"); echo var_dump($conn_id); $c = ftp_login($conn_id, FTP_USER, FTP_PASS); echo "<br>"; echo var_dump($c); 
+6
source share
2 answers

Sometimes it also matters if you use passive or active mode to connect. I recently encountered the same problem that you are facing.

You can try this before logging in:

 // turn passive mode on ftp_pasv($conn_id, true); 
0
source

In most cases, this error occurs only when FTP authorization rules for the FTP site are not set by default.

-1
source

Source: https://habr.com/ru/post/988372/


All Articles