here is the PHP code that should be handling everything, and works fine on my local server, but not on our other server running PHP 4. It does allow me to connect to the server, but it fails to run anything much beyond that. I can get ftp_pwd() and such, but I cannot get a rawlist?
Please give it a look over and explain anything you see that could even remotely be the cause of such strange issues.
Code: Select all
<?php
$dateis = date("m-d-y");
$filename = "CableOrganizer_".$dateis."_access2";
$ftpServer = "****";
$ftpUser = "****";
$ftpPass = "****";
set_time_limit(160);
$conn = ftp_connect($ftpServer)
or die("Couldn't connect to FTP server");
$login = ftp_login($conn, $ftpUser, $ftpPass)
or die("Login credentials were rejected");
@ftp_chdir($conn, '/');
$files = ftp_rawlist($conn,'/');
$workingDir = ftp_pwd($conn);
echo "You are in the directory: $workingDir";
for($i = 0;$i < count($files); $i++){
echo "<p>$files[$i]</p>";
}
$putFile = ftp_put($conn, "$filename.gz", "cableorganizer-access-log.gz", FTP_BINARY);
if($putFile)
echo "File uploaded OK.";
else
echo "File upload failed.";
ftp_quit($conn);
?>