I use the amazing wp-cli (http://wp-cli.org/) to install WordPress on my development machine, but for some reason the file and directory permissions are always wrong.
I have added this step as part of my installation procedure:
wp core download # Use wp-cli to download the latest WordPress chown www-data:www-data -R * # Let apache be owner find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
This sets all the permissions correctly so Apache no longer gives any errors.