Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ftp_exec

Status
Not open for further replies.

cruel

Programmer
Aug 6, 2001
131
I need to submit a shell script execution request so I resort to ftp_exec. FTP connection etc are fine, but ftp_exec won't do anything. PHP script I used is nothing fancy just ftp_exec($ftp_connection, $command).

Is there any configuration I missed or any debugging tools/functions I could use to find out why?

I use Apache 1.3.34, PHP 4.4.2, thanks!
 
$ftp_connection = ftp_connect($_POST['host']);
ftp_login($ftp_connection, $_POST['user'], $_POST['passwd']);

$command = 'ls > file_list';
ftp_exec($ftp_connection, $command);

then it produces an error message:

Warning: ftp_exec(): 'SITE EXEC ls ': command not understood.

Thanks
 
I think the operative warning comes from a user-supplied comment on the ftp_exec() online manual page:

A word of caution, execution via FTP isn't very widely supported. Check that it works on the servers that you intend to connect to before you start coding something that requires this.

If you want a directory listing, I think you should try ftp_nlist() (

Want the best answers? Ask the best questions! TANSTAAFL!
 
Thanks for the response. I saw that warning before, but I could use a bit more specific information as to why it does not work? All other php ftp function works the unix server, so it has to be ftp_exec specific, i.e., execute an unix server command via ftp.
 
just in case it is useful, i have found that one of my hosts allows (probably by oversight) the execution of system commands notwithstanding that i do not have root access.

i use the excellent php terminal emulator (phpterm.sourceforge.net) to enter the commands.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top