Some PHP FTP commands won't execute across domains.
Posted: Wed Feb 06, 2008 9:44 pm
Below is some php code for simply printing the array of filenames within the folder "images" at a certain FTP address.
The code works just fine if I use it within the same domain. (i.e. I execute the script on my mediatemple server, and define the FTP info as an FTP account within the same domain).
However, when I run the script on my mediatemple account, and define the FTP info on a different domain (a different mediatemple-hosted FTP site, different domain), it does nothing, then times out after 90 seconds.
Can anybody tell me what I'm doing wrong?
The code works just fine if I use it within the same domain. (i.e. I execute the script on my mediatemple server, and define the FTP info as an FTP account within the same domain).
However, when I run the script on my mediatemple account, and define the FTP info on a different domain (a different mediatemple-hosted FTP site, different domain), it does nothing, then times out after 90 seconds.
Can anybody tell me what I'm doing wrong?
Code: Select all
<?php
$ftp_server=<IP address>;
$ftp_user_name =<username>;
$ftp_user_pass =<password>;
// set up basic connection
$conn = ftp_connect($ftp_server) or die("Could not connect");
if(ftp_login($conn,$ftp_user_name,$ftp_user_pass)){
echo("connected<br>"); //this works no matter what
echo ftp_systype($conn); //this also works
print_r(ftp_nlist($conn,"images")); //this makes it hang and timeout after 90 secs
};
ftp_close($conn);
?>