I am very frustrated with a problem involving FTP and PHP:
Here is the condensed version of my problem: I created a website for a client using PHP on go daddy.com. The code uses FTP within PHP. Works great on their. I moved the site over to Network Solutions and the FTP portion of the code stopped working.
To remove complexity of the problem, I wiped my code out on the NS site and created a single php file that tries to connect to an FTP site, get a dir listing, and log out. I thought I could start simple and work my way up until I could find the problem. You can see the code below.
When I run this script on NS it just times out like it either couldn’t resolve the name or get a connection to the Internet. If I replace the host address (ftp.microsoft.com with anything else it makes no difference, ftp.funet.fi, ftp.networksolutions.com, nothing). It just chews on that script until it times out.
Same coded tested on three different hosting sites (go daddy, a plus, etc…) works great. It instantly comes back.
I replaced the domain name with the IP address and it makes no difference. It is like it can’t even get to the Internet so it just times out.
I called NS and I get this “We don’t troubleshoot scripts” crap but I am at a loss given the simplicity of this script and the error. They suggestion either the code bad or the php.ini file is bad. I use the same code across three test sites and it works. I review NS’s temp php file and it seems fine. However, I make a copy of the other php.ini files from the other sites and try each one individually to see it makes a difference. Nothing, just times out.
I was wondering if anyone here had any suggestions.
Thanks for reading!
-P
[php]<?php
$host = ‘ftp.funet.fi’;
$usr = ‘ftp’;
$pwd = ‘[email protected]’;
$conn_id = ftp_connect($host, 21) or die (“Cannot connect to host”);
ftp_login($conn_id, $usr, $pwd) or die(“Cannot login”);
$buff = ftp_rawlist($conn_id, ‘/’);
ftp_close($conn_id);
var_dump($buff);
?>[/php]