ftp_exec() not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Bone
Forum Newbie
Posts: 1
Joined: Mon May 22, 2006 9:29 am
Location: Planet Earth

ftp_exec() not working

Post by Bone »

Can anyone tell me if there is an known bug with php's ftp_exec() function not working. Every time I execute the code on an FC3 server php 5. I get an error message saying ...
Warning: ftp_exec(): Unknown SITE command.

the code looks something like this...

<?php

$conn = ftp_connect($host, $port);
$command = "ls -l ";

if (ftp_exec($conn, $command)) {
echo "$command executed successfully\n";
} else {
echo "could not execute $command\n";
}


?>


:?:
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: ftp_exec() not working

Post by RobertGonzalez »

Code: Select all

<?php
$conn = ftp_connect($host, $port);
$command = "ls -l"; // Removed the space at the end of -l

if (ftp_exec($conn, $command)) {
   echo "$command executed successfully\n";
} else {
   echo "could not execute $command\n";
}

?>
Not sure if it will do anything, but I removed the space at the end of ls -l.
Post Reply