The error:
Warning: ftp_exec(): Permission denied. in
/src/php/prueba/ftp_test.php on line
37.
My code:
<?
$ftps = array( host => "localhost",
user => "ftp",
psswd => ""
);
//Openning a ftp connection
$conn = ftp_connect( $ftps["host"] );
if( !$conn ){
echo "FTP server connection error" . "<BR>";
exit;
}
else{
echo"Connected to FTP Server" . "<BR>";
//Login to the FTP server.
@$result = ftp_login( $conn, $ftps["user"], $ftps["psswd"] );
if( !$result){
echo "The page couldn't log in as : " . $ftps["user"] . "<BR>";
ftp_quit( $conn );
exit;
}
echo "You are user: " . $ftps["user"] . "<BR>";
//Getting file's time from the FTP_Server.
$time = ftp_mdtm( $conn, "/alex/hola.txt" );
echo date("D d-M-Y -- H:i:s", $time) . "<BR>";
//Executing shell script.
//my_script is a shell script which only has an echo statement.
$res = ftp_exec($conn, "/src/shell_scripts/my_script");
echo "Script Shell result: " . $res;
ftp_quit( $conn );
}
?>
I executed the same shell script using a ftp client and it did it, so I suppose that it will also execute using the FTP functions of PHP.
I configured PHP with --enable-safe-mode. Does it affect when I try to use
ftp_exec() function?