need a script to transfer a file from A server to B server

Discussion in 'PHP' started by myinnet, Nov 12, 2012.

  1. #1
    I have some important files need to backup from A server to B server, How could i create the php file to transfer it with ftp function? any help is appreciate.
    John
     
    myinnet, Nov 12, 2012 IP
  2. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #2
    how big are the files?
     
    stephan2307, Nov 12, 2012 IP
  3. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #3
    why ftp functions? could you tell me why that's a requirement?
     
    EricBruggema, Nov 12, 2012 IP
  4. myinnet

    myinnet Peon

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    less than 2 MB, because i want to backup the files automatic. these are important files.
     
    myinnet, Nov 12, 2012 IP
  5. ROOFIS

    ROOFIS Well-Known Member

    Messages:
    1,234
    Likes Received:
    30
    Best Answers:
    5
    Trophy Points:
    120
    #5
    If it's your DB there's a remote MySQL DB feature in cpanel that you could use concurrently with your current DB, thus you'd have instant backup. Alternatively you'd need to set up a cron job to the remote server's ftp to upload— there's ample scripts, classes and other code snippets online for this. :)





    ROOFIS:cool:
     
    ROOFIS, Nov 12, 2012 IP
  6. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #6
    If you are transferring large files you need to FTP in to the old server from the new server via the shell.

    Do NOT transfer large files via PHP. PHP will transfer the files via the web server which will have restrictions on execution time.
     
    NetStar, Nov 12, 2012 IP
  7. myinnet

    myinnet Peon

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    i think 2Mb is not too big, Yes, it is a DB file, but it is access DB, not Mysql. also the server is window, not linux. the window server can run php script. hope someone can help me to get the code.
     
    myinnet, Nov 12, 2012 IP
  8. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #8
    If it's just 2MB... download it.. upload it... geesh don't over complicate things
     
    NetStar, Nov 12, 2012 IP
  9. myinnet

    myinnet Peon

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    but i need to backup the files every week. so i try to get a script to do it.
     
    myinnet, Nov 12, 2012 IP
  10. sandiegotech.net

    sandiegotech.net Greenhorn

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #10
    Remote backup Ibackup

    Don’t ever use Ibackup, besides supper slow software that will use tons of resources, small tech support group, they will get you this way:

    You sign up for a contract let’s say of 100 G. for 10.00 Dollars; The next plan is 20.00 dollars for 250 Gigs. So you are not there at the time.

    After 3 months your business grows, and you need now to backup 150 G.

    You get an email your out of quota, I mean don’t panic, you know you will have to upgrade your plan to the next level of $20.00

    No problem correct?

    Wrong!

    You will be charged insanely instead of going to a new contract.

    Sorry Ibackup two thumbs down.
     
    sandiegotech.net, Nov 15, 2012 IP
  11. abhirampathak3

    abhirampathak3 Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    you can try this. but i never ever tried. i got this in my web server forum

    #!/bin/ksh if [ -r ftp.pid ] then echo previous invocation still running exit fi echo $$ >ftp.pid ftp A <<EOF >A.list user password ls quit EOF ./createnewlist.ksh <A.list >new.list sleep 10 ftp A <new.list rm ftp.pid
     
    abhirampathak3, Nov 19, 2012 IP