Connect to a FTPS server using Server Side Language

WebserviceMX used Ask the Experts™
I need to connect to a FTPS service using a server side language like php or perl.

Using PHP ftp_ssl_connect (, succesfully can connect, and perform almost all commands except for put/get,  every file that i send to repository or get from it results in a zero byte file.

I've tried also with Net::FTPSSL in Perl but same issue.

Some one got experience on this case and can help me?

Also i need to install some SSL certificates, where do i need to place them in order to connect with FTPS service?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
If you can connect but not transfer files that usually means that the control channel is working fine but the data channel is blocked.  Try switching between Active and Passive modes for the data channel.
Software and Hardware Engineer
Alex is correct - this is virtually guaranteed to be a firewall/nat issue, not a scripting language one.

In active mode, ftps requires that you can connect BACK from the target server to the ftp client server; in ftp, that's fine (the firewall takes care of it for you) but because in ftps the control channel is encrypted, it is unable to rewrite the IP and port to reflect the nat translation.

use pasv mode ( to enable a mode where all connections are forward (from the client to the server) and hence more NAT friendly.

Now regarding certificates, ftp sets its options via this call:
Note further that the ssl options are applicable to ftps:
and I would expect verify_peer, allow_self_signed and cafile to be of most interest to you there :)


Thanks @AlexPace and @DaveHowe let me check if i can fix it that way

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial