PHP Server Copy V .01
Writing by shinda on Wednesday, 2 of August , 2006
One of the biggest pains in hosting a website comes when you realize that you need to switch servers, or mirror a website. Ideally your initial server should do you just fine, but theres always those times when you find a better deal, the initial server gets hacked and you need to move, or for whatever reason you need to move your site, to another server.
Now if your site hosts a lot of files, this can present itself to be a problem in fact become a quite cumbersome ordeal especially if you have a slow Internet connection or limited bandwidth.
It is in that problem that lies the solution which is this script. I searched around for a bit to find a script that could help me mirror a copy of a website, but there was nothing that was simple.
Luckily PHP can handle FTP protocol seamlessly so creating a script wasn’t all that much of an ordeal.
Usage
1) Fill out the FTP connection information
$ftp_server = "ftp.yourftpaddress.com";
$ftp_user_name = "ftp-username";
$ftp_user_pass = "ftp-password";
$ftp_dir = "/your/folder/here/";
2) Enter the URL where you want to copy all files from ftp to.
*** Make sure that the folder is writable (CHMOD 777)..
3) Save and upload to your server.
4) Run ftp.php by visiting the URL or running the cron job.
Notes
The only testing this script got was when I used it to copy over all my sites from the old server over, and it worked, so theres no super bugs to report.
This is version 1, I doubt that I’ll make a version 2, and don’t think that a nice front-end is necessary. After all the fact that you’re responsible for copying over the site dictates that you have some degree of computer/programming knowledge.
If the script seems to hang up then just stop the page and refresh. Script is smart enough to not replace existing files (if they match that is, and if your server supports ftp_size() );.
No idea if file resume works. I tried to code it in, but never came abouts to testing it.
Warning
This script has the potential to mess up your server if used improperly. By reading and using this, you agree that I am not liable in any shape or manner for any damages and or loss of data that may occur. With that said, I don’t expect the script to wreak all that much havoc on a properly configured server, however you have been warned.
Download
Comments (19)
Category: Tech














