title: Php session files permissions
body: <p>I have file index.php:</p>
  
  <pre><code>&lt;?php    
  session_start();
  $_SESSION['favcolor'] = 'green';
  </code></pre>
  
  <p>And I get result:</p>
  
  <pre><code>Warning: session_start() [function.session-start]: open(/tmp/sess_a8njkmbcg3lbkvl7f2hhjchjm5, O_RDWR) failed: Permission denied (13) in /var/www/test.local/index.php on line 9
  Warning: Unknown: open(/tmp/sess_a8njkmbcg3lbkvl7f2hhjchjm5, O_RDWR) failed: Permission denied (13) in Unknown on line 0
  Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
  </code></pre>
  
  <p>php.ini</p>
  
  <pre><code>root@savpc:/etc/php5/apache2# cat php.ini | grep '^session'
  session.save_handler = files
  session.save_path = "/tmp"
  session.use_cookies = 1
  session.use_only_cookies = 1
  session.name = PHPSESSID
  session.auto_start = 0
  session.cookie_lifetime = 0
  session.cookie_path = /
  session.cookie_domain =
  session.cookie_httponly =
  session.serialize_handler = php
  session.gc_probability = 0
  session.gc_divisor = 1000
  session.gc_maxlifetime = 1440
  session.bug_compat_42 = Off
  session.bug_compat_warn = Off
  session.referer_check =
  session.entropy_length = 0
  session.cache_limiter = nocache
  session.cache_expire = 180
  session.use_trans_sid = 0
  session.hash_function = 0
  session.hash_bits_per_character = 5
  </code></pre>
  
  <p>in file system i get files with <strong>strange permissions</strong>:</p>
  
  <pre><code>root@savpc:/tmp# ls -al | grep 'sess' 
  ----------  1 www-data www-data  2106 2013-11-11 19:21 sess_7cvcojv36n6se6mkrqmui7tu707u9avb
  ----------  1 www-data www-data    21 2013-11-11 19:23 sess_a8njkmbcg3lbkvl7f2hhjchjm5
  ----------  1 www-data www-data  1040 2013-11-11 19:21 sess_gllhhosb9dur0jdvf13lqe5klmebj1k9
  ----------  1 www-data www-data  2106 2013-11-11 19:21 sess_m8c788u0jssqg1gqjeonafk0er5jnbsk
  </code></pre>
  
  <ul>
  <li>Ubuntu 11.10 </li>
  <li>Apache Version:  Apache/2.2.20 (Ubuntu) </li>
  <li>PHP Version 5.3.6-13ubuntu3.10</li>
  </ul>
  
  <p>In what can be the problem?</p>