Reputation: 21
I'm trying to do an ftp upload between my website and a remote server.
I'm getting this error PHP Warning: ftp_put(): php_connect_nonb() failed: Operation now in progress (115).
I did research and I believe this is the problem http://www.elitehosts.com/blog/php-ftp-passive-ftp-server-behind-nat-nightmare/
The thing is, I cannot download the patch because I'm using Godaddy Cpanel, and they said the hosting we have does not allow it and I also cannot ssh into it to be able to run command line.
I read that in PHP v5.6+ the patch was applied but I cannot get ftp_set_option($ftpconn, USEPASVADDRESS, true); to work. It doesn't recognize USEPASVADDRESS, which I thought it would because I'm using v5.6.22.
Upvotes: 2
Views: 5713
Reputation: 1517
Maybe you've already managed to get around it, but the correct constant to use is FTP_USEPASVADDRESS
, not just USEPASVADDRESS
, regardless of what you can find at the nightmare page. That's independent of Godaddy or other hosting (but please note that I don't use Godaddy, so I can't bet it works there).
Moreover, the example at the nightmare page can be misleading, because it reports the code to make PHP behave as if that option didn't exist at all (e.g. make it behave like it already does by default):
ftp_set_option($ftpconn, USEPASVADDRESS, true);
echo "USEPASVADDRESS Value: " . ftp_get_option($ftpconn, USEPASVADDRESS) ? '1' : '0';
ftp_pasv($ftpconn, true);
I think the best example that page could give would be something like this instead:
ftp_set_option($ftpconn, FTP_USEPASVADDRESS, false);
echo "FTP_USEPASVADDRESS Value: " . ftp_get_option($ftpconn, FTP_USEPASVADDRESS) ? '1' : '0';
ftp_pasv($ftpconn, true);
e.g. it could show how to actually use that option, not how to waste a line of code to set an option to its default value.
Upvotes: 5