By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,740 Members | 844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,740 IT Pros & Developers. It's quick & easy.

sending a variable to a shell script?

P: n/a
At the end of a PHP script, I'm sending a file via FTP to a server.
I thought it'd be best to use a shell script in order to automate the
FTP (logging in, changing to binary, putting the file, etc.) (If this
can all be done in PHP, that'd be great.)
But, how do I tell the shell script what the file name is supposed to
be?

Here's what I have so far:

from the PHP script:
$filename = 'XXX111.ZIP'; // A dynamically created filename
exec('/var/www/html/services/ftp.sh');

The script:
#!/bin/sh
ftp -n (servarname) <<EOC
user (username) (password)
lcd /var/www/html/services/zip
binary
put (filename)
bye
EOC
If I can do all that in PHP, cool, but I think this will work fine if I
can send the script the filename.

Also, is there a problem with closing the PHP script after calling the
shell script, without affecting the FTP process?
Well, I guess I can find that out myself. =)
Thanks!
-Liam

Apr 10 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Hi Liam,

It can be done in php, and it's made fairly easy.

See:
http://uk.php.net/ftp

Apr 10 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.