Page 1 of 1

ftp_exec problem

Posted: Thu Nov 16, 2006 7:48 pm
by urieilam
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


This is kind of a part II to a question a posted earlier about exec and shell_exec not working.

I'm trying to use ftp_exec to execute some simple command:

Code: Select all

<?php
$conn_id = ftp_connect("$server") or die ("Cannot initiate connection to host");
ftp_login($conn_id, "$username", "$userpass") or die("Cannot login");
$command = 'cd..';
if (ftp_exec($conn_id, $command)) {
   echo "$command executed successfully\n";
} else {
   echo "could not execute $command\n";
}

ftp_close($conn_id);
?>
I'm getting the following error:

Warning: ftp_exec() [function.ftp-exec]: SITE EXEC is an unknown extension in /home/urieilam/public_html/work/video/test1.1.php on line 21
could not execute cd..

Have tried other commands as well, get the same. Could this be a security issue? I don't know much about commands, shell, etc..
Any info would be really appreciated.
Thanks
Uri


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Nov 16, 2006 8:06 pm
by feyd
I believe that is saying your FTP server doesn't support the SITE EXEC command.

Posted: Sat Nov 18, 2006 12:09 pm
by urieilam
i also can't run exec (regular, not ftp). could this have to do with php security settings?

Posted: Sat Nov 18, 2006 12:17 pm
by feyd
The FTP command and PHP are completely separate systems. Your host has likely disabled exec() and its siblings, or has severely limited what you are allowed to run... both are quite normal for most hosting companies.

Posted: Sat Nov 18, 2006 12:38 pm
by urieilam
any idea for a way around it, so that i could run my application (ffmpeg)? using SSL it works fine, but if php can't run it, how can i make it accessible through a bropwser?

Posted: Sat Nov 18, 2006 12:41 pm
by feyd
Have you talked about it with your host?