views:

29

answers:

3

When connecting to mysql, I have functions to get the relevant error message and error code, I see nothing of the sort in the list of ftp functions of PHP.
Is there a best practice to handle errors in FTP?

EDIT+CLARIFICATION: I think the best error messages are the system error messages + my own, is there a way to catch the system error messages?

A: 

Looks like most of the ftp functions just return a true or false status. Some trigger a warning.

So the option you probably have is to check return status and have a meaningful error log for yourself.

zaf
A: 

You can check the values returned by the functions. Usually it will return something like true (success) and false (fail). For instance, take ftp_fget. php.net says:

Returns TRUE on success or FALSE on failure.

nc3b
+1  A: 

Try error_get_last() for PHP >= 5.2 or $php_errmsg for older versions as detailed at the linked pages

Marc B