This is due to media download in Wordpress.
Each time WP creates a folder for new downloads (it organizes downloads by year and month: yyyy / mm), it creates it with the user and the "apache: apache" group with full access to everyone (777 or drwxrwxrwx ).
However, after that, WP cannot create a folder inside this folder (for example: mkdir 2011 succeeds, but mkdir 2011/01 does not work). In addition, the download cannot be moved to these newly created folders, even if the permissions are 777 ( rwxrwxrwx ).
Once a month, I should chown newly created folders to be the same as the user: group, like the rest of the files. As soon as I do this, the download stops working (which makes no sense to me. The really disappointing part is that this problem does not exist in other WP installations in other domains on the same server.
* I was not sure what it should be here or on the server.
Edit: the containing directory /.../httpdocs/blog/wp-content/uploads has the correct ownership
drwxrwxrwx 5 myuser psaserv 4096 Jun 3 18:38 uploads
This is the Plesk / CentOS environment hosted by Media Temple (dv).
I wrote the following test script to simulate a problem
<pre><?php $d = "d" . mt_rand(100, 500); var_dump( get_current_user(), $d, mkdir($d), chmod($d, 0777), mkdir("$d/$d"), chmod("$d/$d", 0777), fileowner($d), getmyuid() );
The script always creates the first mkdir($d) directory successfully. In domain A, where WP is a problem, it cannot create the mkdir("$d/$d") . However, in domain B, both directories have been successfully created.
I run each script in /var/www/vhosts/domainA/httpdocs/tmp/t.php and /var/www/vhosts/domainB/httpdocs/tmp/t.php respectively, I checked permissions on tmp , httpdocs and domain[AB] , and they are the same for every path. The only thing that is different is the user.