![]() |
Best way to copy from server to server?
I have a video converter on www.*.com. After converting, it sends the file to img.*.com and want your ideas on how to send the file across. They are on different servers.
Currently, on www.*.com, I use something like this: Code:
fsockopen('img1.domain.com', 80); Code:
if (MD5 security check) { Does anyone think there is a better method of doing this? JM |
Try cURL?
|
Try PHPcli?
|
scp possibly?
|
Looks like you're loading the entire temp upload file into memory in order to save a copy? PHP is probably hitting the configured maximum memory limit for a script. Why don't you just use php's copy() function?
If it's still failing then try increasing the value of upload_max_filesize in php.ini |
Quote:
|
Pre-empting an "I need to load the file into memory in order to md5 it" reply... use md5_file() :)
|
rsync or perhaps wget
|
Quote:
Quote:
Quote:
Amazing how a different pair of eyes saw that immediately! |
Quote:
|
send a url to the 2nd server...
then from the 2nd server initiate a GET request with curl to grab the file from the first server... POSTing large files is usually problematic, there are more than dozen things than can go wrong... GET is 10x more robust... or just use scp or rsync.... |
Quote:
|
you can use the method you are using ... although maybe not the most efficient way, it does the trick ...
just run it from within the SCREEN command (linux/unix) so that even if your connection burps or hits a bump in the road, the process will keep going ... http://magazine.redhat.com/2007/09/2...to-gnu-screen/ |
Quote:
file_get_contents('http://www.otherserver.com/get.php?filename=whatever'); get.php: shell_exec("wget http://www.firstserver.com/files/".$_GET[filename]); Thats it in a nutshell, but add sanitization on the inputs, check the server ip on get.php etc... |
use rsync. It will make the entire md5 process for you and ensure that the content on both servers is always the same.
|
All times are GMT -7. The time now is 02:54 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc