note 57890 deleted from ref.exec by jome
| From: | jome@php.net | Date: | Tue, 18 Oct 2005 12:52:24 +0000 |
| Subject: | note 57890 deleted from ref.exec by jome | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97166@lists.php.net to get a copy of this message | ||
Note Submitter: kenlichen at gmail dot com
Reason: bad code
----
I wrote a ftp script to transfer files from web page.
The server is Redhat El 3.0.
I use exec() function to execute this script.
It doesn't work well.
exec("./ftp.sh $host $username $passwd $file_path $file);
//----- exec() dose not work well!!
But if I use system(), it works.
system("./ftp.sh $host $username $passwd $file_path $file);
//----system() works.
ftp.sh scripte:
#!/bin/bash
echo 'open '$1'
user '$2' '$3'
bi
ha
lcd '$4'
put '$5'
close
quit' > ftp.param
ftp -invd < ftp.param
I hope this is useful for anyone trying to automatic ftp files from web page.