title: How to scale a PHP application (servers, mysql, memcache)
body: <p>I'm currently creating a website for a social project in switzerland.</p>
  
  <p>And before there is an overflow of user, I want to prepare the application to scale.</p>
  
  <p>I answered by myself many questions but some are left.</p>
  
  <p>I explain what I want to do.</p>
  
  <hr>
  
  <p><strong>First</strong></p>
  
  <p>at the beginnning, the Application will have only one server (short time) with DNS, PHP, Mysql, Data, and memcache.</p>
  
  <hr>
  
  <p><strong>Second</strong></p>
  
  <p>Then I will split them in two</p>
  
  <ol>
  <li>DNS, Mysql, memcache</li>
  <li>Data, PHP</li>
  </ol>
  
  <hr>
  
  <p><strong>Third</strong></p>
  
  <p>Here is the problem, I don't know how to do it exactly here to keep the application running well.</p>
  
  <p>I could do :</p>
  
  <ol>
  <li>Front : Load Balancer, memcache, DNS</li>
  <li>Web 1 : PHP, DATA</li>
  <li>Web 2 : PHP, DATA</li>
  <li>Mysql</li>
  </ol>
  
  <p>This would be the scheme, all PHP sessions are kept in the DB.</p>
  
  <p>BUT, how do I sync the data?
  do I run a Rsync to keep them up to date.
  do I put them on a separate disk (network disk) to be sure ?
  but in this case, how can I do in case of user uploads ?</p>
  
  <p>and if the website gets more success and we have to go on greater structures, would'nt it create some latency on updates ?</p>
  
  <p>or would it be a good thing to go directly to amazon's web services ?</p>
  
  <p><strong>some infos</strong>
  I use codeigniter as Framework.
  I use linux as webserver (distribution not chosen now, but should be Debian)</p>
  
  <p>Thanks in advance for your answers.</p>