[php] ftp_login() gives 500 server error
by jonaskellens from LinuxQuestions.org on (#54NGG)
Hello
I have the following code.
Code:error_reporting(E_ALL);
ini_set('display_errors', '1');
// FTP-SSL connection
$ftp_conn = ftp_ssl_connect($ftp_server);
print_r($ftp_conn);
// FTP login
$login_result = ftp_login($ftp_conn, $ftp_user_name, $ftp_user_pass);
print_r($login_result);
if (!$login_result) {
die ("login failed");
} else {
// FTP upload
}
// Close FTP connection
ftp_close($ftp_conn);This results in 500 Internal Server error.
When I omit the ftp_login() all finishes correct.
So the problem is at ftp_login() level.
$ftp_conn gives output : Resource id #2
Even though I have error_reporting on, I get no output at all to point me in the correct direction.
Filezilla is no problem :
Code:12:05:57 Status: Connecting to xx.xx.xx.xx:21...
12:05:57 Status: Connection established, waiting for welcome message...
12:05:57 Status: Initializing TLS...
12:05:57 Status: Verifying certificate...
12:05:59 Status: TLS connection established.
12:06:00 Status: Logged in
12:06:00 Status: Retrieving directory listing...
12:06:01 Status: Directory listing of "/" successfulI also tried : use ftp_connect()
Result : same result at ftp_login()
So... I have no idea.


I have the following code.
Code:error_reporting(E_ALL);
ini_set('display_errors', '1');
// FTP-SSL connection
$ftp_conn = ftp_ssl_connect($ftp_server);
print_r($ftp_conn);
// FTP login
$login_result = ftp_login($ftp_conn, $ftp_user_name, $ftp_user_pass);
print_r($login_result);
if (!$login_result) {
die ("login failed");
} else {
// FTP upload
}
// Close FTP connection
ftp_close($ftp_conn);This results in 500 Internal Server error.
When I omit the ftp_login() all finishes correct.
So the problem is at ftp_login() level.
$ftp_conn gives output : Resource id #2
Even though I have error_reporting on, I get no output at all to point me in the correct direction.
Filezilla is no problem :
Code:12:05:57 Status: Connecting to xx.xx.xx.xx:21...
12:05:57 Status: Connection established, waiting for welcome message...
12:05:57 Status: Initializing TLS...
12:05:57 Status: Verifying certificate...
12:05:59 Status: TLS connection established.
12:06:00 Status: Logged in
12:06:00 Status: Retrieving directory listing...
12:06:01 Status: Directory listing of "/" successfulI also tried : use ftp_connect()
Result : same result at ftp_login()
So... I have no idea.