|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63968 Wrong permissions for temporary files on upload
Submitted: 2013-01-11 15:36 UTC Modified: 2021-09-09 13:44 UTC
Avg. Score:3.2 ± 1.3
Reproduced:0 of 1 (0.0%)
From: web at bartwell dot ru Assigned: cmb (profile)
Status: Feedback Package: Unknown/Other Function
PHP Version: 5.4.10 OS: FreeBSD 8.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
11 - 11 = ?
Subscribe to this entry?

 [2013-01-11 15:36 UTC] web at bartwell dot ru
I have server with FreeBSD 8.0, Apache 2.2.23 and PHP 5.4.10. That is my VirtualHost config:
<VirtualHost *>
    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/

/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.

How to fix it?

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?

Expected result:
I want that the temporary file creating with 660 permissions (and site:www).

Actual result:
This temporary file creating with 600 permissions (and site:www).


patch-main_open_temporary_file (last revision 2013-01-11 20:06 UTC by web at bartwell dot ru)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-11 20:08 UTC] web at bartwell dot ru
I'm upload my patch here. Now it working fine with this patch, but show the warning "Warning: move_uploaded_file(): Operation not permitted in /path/to/script.php on line 111". How to suppress this warning - I don't know.
 [2021-09-09 13:44 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-09-09 13:44 UTC]
Is this still an issue with any of the actively supported PHP

[1] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Sep 17 09:03:37 2021 UTC