The following PHP script fails to create the directory. It will also fail to create the file (when the directory already exists).
ini_set('error_reporting', E_ALL);
define('ABSPATH', $_SERVER['DOCUMENT_ROOT']);
echo ABSPATH . '<br /><br />';
$dir_to_make = ABSPATH . '/aaatest';
$file_to_make = ABSPATH . '/aaatest/aaatest.txt';
echo umask() . '<br />';
mkdir($dir_to_make) or die('could not create directory');
fopen($file_to_make) or die('could not open/create file');
The umask() is returning a value of 18. The document root has a period in it ( /var/www/blah/websitename.com/httpdocs ).
I don't completely understand umask(), nor am I sure of how to properly use it. I don't know if that's the problem or not, but it does seem to be likely. Should I change the umask, create the file/directory, then change it back? What should the umask be to change/make/edit files/directories? Should the server be configured differently?