title: How to force PHP set correct permissions on files uploading?
body: <p>I have server with FreeBSD 8.0, Apache 2.2.23 and PHP 5.4.10. That is my VirtualHost config:</p>
  
  <pre><code>&lt;VirtualHost *&gt;
      ServerName site.com
      ServerAlias www.site.com
      DocumentRoot /usr/home/site/pub/htdocs/
      php_admin_value open_basedir /usr/home/site/
      php_admin_value session.save_path 0;0660;/usr/home/site/pub/tmp/
      php_admin_value upload_tmp_dir /usr/home/site/pub/tmp/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>/usr/home/site/pub/tmp/ owned by site:www with 4770 permission. Session files creating correctly (660 and site:www). But uploaded temporary files creating with 600 in permissions. So, because this temporary file owned by site:www and Apache running from www:www, move_uploaded_file() cannot move file.</p>
  
  <p>How to fix it?</p>
  
  <p>I think that I need patch PHP for force set permission on this tmp file. But where? And which internal function in PHP can to do it?</p>