The SF PHP Meetup Group Message Board › PHP Warning: ftp_put(): Switching to Binary mode.
| Alex Albino | |
|
|
I tried using PHP's ftp_put() method to upload a .gz file into a remote FTP slot in binary mode.
The remote server only allows "ACTIVE", not "PASSIVE". I'm able to execute the script just fine when I run it off of my development machine (ubuntu 11.10 command line php5). The file is uploaded just fine. When I run the exact same script on our server (Amazon EC2 instance), the script chokes on the call to PHP's ftp_put() method with the following warning: "PHP Warning: ftp_put(): Switching to Binary mode." Interestingly enough... When I attempt to manually upload the file using the "ftp" command (bash shell) on the server, I cannot use the "ls" command, or the "put" command. Use of either of these commands results in a message that reads "421 Service not available, remote server has closed connection" I need help figuring out what needs to be configured (and if it's within my reach in an Amazon EC2 instance) or what would cause this issue. Thanks in advance, I'll owe you a beer if you figure it out! ![]() - Alex Albino (I've used **** in place of actual user name, remote server, and password values) $ ftp ftp> open ftp.****.com Connected to ftp-vip.vir.****.com. 220 **** FTP#1 Service - All Transfers Are Logged - YOU MUST USE ACTIVE MODE Name (ftp.****.com:****): **** 331 Please specify the password. Password:**** 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 421 Service not available, remote server has closed connection ftp> |
| Alex Albino | |
|
|
...Turns out it had everything to do with the way Firewalls and NAT redirection are set up...and it was out of my hands. So...guess that's that. :-)
(If anyone ever reads this, just know that there is no sane reason anyone should ever use an unencrypted active FTP connection. It's a security no-no that is just begging for trouble. I had to try due to a decision the powers that be made, not out of my own will. Fortunately, I was finally able to reason with said powers, and switch us over to SFTP instead.) |
| Ted Paff | |
|
|
Said powers appreciate your persistence!
|