title: Chmod for PHP web application
body: <p>Im writing web application. It's have:</p>
  
  <ul>
  <li>index.php</li>
  <li>/app - of course, with .htaccess but im not talking about it</li>
  <li>/app/session - for sessions, session_save_path(/app/session) must be used on my server</li>
  <li>/app/include - index.php includes files from this directory</li>
  <li>/app/config - only .xml files, that files reads classes from scripts in include</li>
  <li>/images, /styles etc.</li>
  </ul>
  
  <p>My question is:<br>
  What is correct chmod settings for above directories? I know what is chmod (im working on Linux) and I know how I can change it, but I can't find useful informations about that. Only articles like "How i can change chmod to 777...  </p>
  
  <p>And I don't know who is owner, group and others. My page will be on shared web server, so I think owner is apache, and group is www-data, correct? </p>
  
  <p>Please, tell me what chmod's must have directories (and files? I'm using -R for chmod to files) for safe website. Mainly it comes to the possibility of intrusion by any script.</p>