tibberous Posted January 4, 2009 Share Posted January 4, 2009 I am trying to move videos from one server to another. I used ini_set("memory_limit","100M") to let me use file_get_contents and file_put_contents, but there has to be a way to do it that doesn't load the entire video into memory. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted January 4, 2009 Share Posted January 4, 2009 Are the servers on the same box? If so, just do exec('mv file1 file2'); or rename(). Otherwise, check out the FTP functions. Quote Link to comment Share on other sites More sharing options...
trq Posted January 4, 2009 Share Posted January 4, 2009 Is this just a one off and do you have shell access? I don't see why you'd be wanting to use php for this. Take a look at the scp command providing you have shell access. Quote Link to comment Share on other sites More sharing options...
tibberous Posted January 4, 2009 Author Share Posted January 4, 2009 There physically different servers. The videos are tied into a web app - there are hundreds of them and they are attached to database records that are getting moved over at the same time. The way I have it setup, the videos are moved off the old server into a temporary directory, and a record is inserted into a database. After I move over several accounts, I run the video encoder, which reencodes and indexes all the videos. If I tried to do it by hand it would take weeks... even the mostly automated way I came up with is taking a long time -- each video takes about 15 minutes just to reencode =/ Quote Link to comment Share on other sites More sharing options...
jonsjava Posted January 4, 2009 Share Posted January 4, 2009 I think you need to create a bash script that will scp the file from one server to the other, then outputs something, like "1", or something. Then, you would do an if script like this: <?php $scp = shell_exec("move_file $file_name"); if ($scp == 1){ //run the sql transfer script } else{ //error out here } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.