ftp_exec

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

axeluck
Forum Newbie
Posts: 9
Joined: Thu Apr 24, 2003 4:21 am

ftp_exec

Post by axeluck »

Hi,

I have to perform a perl or a shell program from an internet page by ftp.
When i use this function a message appear : " ftp_exec(): SITE command not implemented".
$FTP_COMMAN= "/export/home/.../create_work_dir.sh";
ftp_exec($ftp,$FTP_COMMAN);

Can someone help me?

Thanks in advance!
User avatar
d1223m
Forum Commoner
Posts: 80
Joined: Mon Mar 31, 2003 5:15 am
Location: UK, West Sussex

Post by d1223m »

do you need to install a module or somthing?

look at the php main page for the ftp commands. there it will list any dependancies
axeluck
Forum Newbie
Posts: 9
Joined: Thu Apr 24, 2003 4:21 am

Post by axeluck »

I don't see any module to install...
User avatar
d1223m
Forum Commoner
Posts: 80
Joined: Mon Mar 31, 2003 5:15 am
Location: UK, West Sussex

Post by d1223m »

In order to use FTP functions with your PHP configuration, you should add the --enable-ftp option when installing PHP 4 or --with-ftp when using PHP 3.

The windows version of PHP has built in support for this extension. You do not need to load any additional extension in order to use these functions.
so you have done this?

after looking some pages and stuff im also wondering if your ftpd actually supports this command. can u test it somehow without php or check the ftpd's docs?
axeluck
Forum Newbie
Posts: 9
Joined: Thu Apr 24, 2003 4:21 am

Post by axeluck »

Yes, i have a windows version of PHP with easyphp.
What is ftpd?
How can i check it without php?
User avatar
d1223m
Forum Commoner
Posts: 80
Joined: Mon Mar 31, 2003 5:15 am
Location: UK, West Sussex

Post by d1223m »

your "ftpd" is your ftp deamon

you could check it with any ftp client that has the command.
if your graphical client cant do it then there is always command line ( Start->Run: ftp.exe ) *grin*


failing that.. well.. there's always telnet
axeluck
Forum Newbie
Posts: 9
Joined: Thu Apr 24, 2003 4:21 am

Post by axeluck »

May be an other method...
i just want perform a program unix from the web...

If any ideas i'm aware.
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

If i have to execute a unix commando in a php script i do it like this.

Code: Select all

$exec = "cd ".$dir."\n".stripslashes($command);
  echo "<pre>";
  $str = passthru($exec." 2>&1");
  echo "</pre>";
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

SITE EXEC is disabled on most ftp servers, simply because it's dangerous and useful like a hole in the head ;)
Is ftp the only access you have to that box?
axeluck
Forum Newbie
Posts: 9
Joined: Thu Apr 24, 2003 4:21 am

Post by axeluck »

yes just ftp access...
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

Hmm, then my code is useless.

Sorry for the mistake.
axeluck
Forum Newbie
Posts: 9
Joined: Thu Apr 24, 2003 4:21 am

Post by axeluck »

if not ftp i don't see how to connect to the unix server...
User avatar
d1223m
Forum Commoner
Posts: 80
Joined: Mon Mar 31, 2003 5:15 am
Location: UK, West Sussex

Post by d1223m »

does the server have a webserver?
axeluck
Forum Newbie
Posts: 9
Joined: Thu Apr 24, 2003 4:21 am

Post by axeluck »

it don't have webserver...
User avatar
d1223m
Forum Commoner
Posts: 80
Joined: Mon Mar 31, 2003 5:15 am
Location: UK, West Sussex

Post by d1223m »

well you need _some_ sort of connect other than ftp.

maybe look into some sort of remote procedure language. ive just been looking at php news and i saw this link: http://www.phpdeveloper.org/index.php?id=1391
Post Reply