Solved

Website Cloning or Mirroring across multiple domains?

Posted on 2009-07-02
7
221 Views
Last Modified: 2013-12-13
I have a website called globallistings.com (fictional), it is a business directory for multiple cities.
This search able online database is built in php , it only uses cookies and does not use sessions to share member info.

I want this website on various servers and share the same mysql data and user image uploads across multiple domains.

Domains For example use:

losangeleslistings.com;
chicagolistings.com;
newyorkcitylistings.com;

when the user goes to his city, he will see a custom website and graphics for his city that shares the same mysql data and user image uploads across all domains.

The main goal is to have many websites for different cities all sharing same mysql data and user image uploads, but each site having a unique design and domain name.

right now the images folder is located at:   ' globallistings.com /images ';
right now the mysql server is on localhost at globallistings.com

I understand myspace and facebook are also using this same system.

Question #1: What is the best way to accomplish this task?

Question #2: If main server is shut down "globallistings.com" can other websites still operate on separate servers?

Question #3: Do i clone the main mysql server or do i share the data from one mysql server across multiple domains?

Question #4: How do i handle user image uploads?

Thank you for your responses.

0
Comment
Question by:zefex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 24768991
Well, that is four questions and we usually answer one question at a time, so I will take a crack at Q#2.

If you have a central server that has your images, and it goes away, your images go away.  So you would probably want to go with a content server like Akamai for this kind of application.

If I were going to answer Question #1, I think the answer would have to be given with an understanding of your budget.  In the development phase, I would just write programming that can be partitioned easily, and have all the domains resolve to the same IP address. If this starts to get the kind of traffic that Facebook carries, you will have different issues that are unrelated to PHP - ie, you will need to hire a lot of lawyers and accountants.

If you have more specific questions about any aspect of this, please post back here and I will try to drill down into the technical issues.

Best regards, ~Ray
0
 

Author Comment

by:zefex
ID: 24769562
Thank you for your response.
::Update:::
I was able to share the mysql database remotely among the different servers and i was also able to share the images.

I am using one mysql server and one folder and sharing the data remotely to the other servers.

The database is passing the information perfectly, but when the php is reading the image info width x height then passing the images it is too long of a delay taking up to 2 minutes to pass the data of one page that contains 30 images in a list.

Now i am considering using Curl with a cron job to update each database for localy for each server. Is this a efficient method? I will be grabbing the images and the data and storing them localy for each host via cron job set at one minute.

Any tips would be greatly apreciated.

@Ray_Paseur: my budget is $0 dollars.
0
 
LVL 19

Expert Comment

by:NerdsOfTech
ID: 24771680
Cron job to compare and update the tables for all of the segregated servers.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:zefex
ID: 24777015
@NerdsOfTech

I know mysql has a function to mirror said server it is called 'Replication Server'. I dont know if this is possible , i am on shared hosting with "The planet (hostgator) " i will also need to mirror the folder that contains uploaded pics, unless i move the images to blob in mysql (not convenient)?

If i cannot use the Replication Server function of mysql because i am on shared with "The Planet Hosting" what is the best way to compare tables of my servers?

What is the best way to compare my images folder from each server?
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 24777166
"What is the best way to compare my images folder from each server?"

This is really a new question, and I recommend that you post new questions when you have new questions.  Given your budget, I am not sure you can guarantee success on this project, but here is how I would go about checking the images folders.

You might use something like this function to get an array of arrays with information about all the files in the images directory.  Then you can use md5() to create a digested string of this multidimensional array.

Compare the md5() string to the previous md5() string.  If they match, the directory has not changed.  It they do not match, you need to update the images folders on the remote servers.

I would not advise putting images into blobs in the MySQL data base.  There are a lot of reasons to avoid doing such a thing - performance and backup issues are two that come immediately to mind.

If you come to trust your central image server, you might consider just using explicit URLs in your <img src=URL /> statements - they images will be resolved and loaded by the browser.  This is what Akamai will do, but they will be serving your images from a high-speed edge network.

Best of luck with it, ~Ray
function dir_list($dir) // GET AN ARRAY OF ARRAYS OF FILE DATA
{
// MAKE SURE WE HAVE A TRAILING SLASH
   if ($dir[strlen($dir)-1] != '/') $dir .= '/';
   
// RETURN EMPTY ARRAY IF NOT A DIRECTORY   
   if (!is_dir($dir)) { return array(); }
 
// OPEN AND READ THE DIRECTORY
   $dir_handle   = opendir($dir);
   $dir_things   = array();
   while ($thing = readdir($dir_handle))
   {
   
// DISCARD KNOWN DIRECTORY INFORMATION - LOOK AT FILES ONLY   
      if (!in_array($thing, array('.','..'))) 
      {
 
// ACCUMULATE FILE INFORMATION 
         $filename   = $dir . $thing;
         $file_thing = array (
            'name' => $thing,
            'size' => filesize($filename),
            'type' => filetype($filename),
            'time' => date("Y-m-d H:i:s", filemtime($filename))
         );
 
// ADD FILE INFORMATION TO THE RETURN ARRAY
         $dir_things[] = $file_thing;
      } // END IF
   } // END WHILE
   
   return $dir_things;
} // END FUNCTION

Open in new window

0
 

Author Closing Comment

by:zefex
ID: 31599380
Thank you, this pointed me in the right direction. Although i could not get the script to work i did write a similiar one using php manual. Thank you!
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 24777912
Thanks for the points - glad you've got it headed in the right direction.  Best, ~Ray
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question