Testing which uid php is running as to debug read/write issues
Often times, a php script needs write access to disk.
Most new installs will use mod_ruid2+cli, suPHp, fastcgi or php-fpm, which should all run php as the given User, rather than as "apache".
To determine what uid a php process is running as, you can use this script to get a definitive answer:
Save this to an info.php file in a path you're trying to debug, then view it through Apache.
Note that this requires that both "system" and "phpinfo" not be set in your disabe_functions list in your php.ini