copying one file from one server to another
Posted: Mon Nov 28, 2005 4:41 am
Hello
I have 2 servers
server 1 at (fake IP) 1.2.3.4
server 2 (server I am locally running on)
I have a file called test.zip in server 1. The file is located at the server's htdocs folder
for example: http://1.2.3.4/test.zip
I am now in server 2 and I want to "pull" (copy) that file from server 1
I created a php file called copy.php in server2 and tried the following:
When I run this simple script, I get the following error:
what could be causing this?
maybe I can use curl_exec to get the file instead of using copy
Note, that the file is very large 70MB. could this be a problem for copy? or even for the script which might time out?
regards
I have 2 servers
server 1 at (fake IP) 1.2.3.4
server 2 (server I am locally running on)
I have a file called test.zip in server 1. The file is located at the server's htdocs folder
for example: http://1.2.3.4/test.zip
I am now in server 2 and I want to "pull" (copy) that file from server 1
I created a php file called copy.php in server2 and tried the following:
Code: Select all
ini_set('max_execution_time', 1800);
set_time_limit(0);
$source = "http://1.2.3.4/test.zip";
$target = "/usr/local/apache/htdocs/test.zip";
if (!copy($source, $target)) {
print "Failed to copy";
}
else {
print "Success";
}Code: Select all
Warning: copy('/usr/local/apache/htdocs/test.zip') [function.copy]: failed to open stream: Permission denied in /usr/local/apache/htdocs/copy.php on line 9
Failed to copymaybe I can use curl_exec to get the file instead of using copy
Note, that the file is very large 70MB. could this be a problem for copy? or even for the script which might time out?
regards