It would be helpful to know what operating system and httpd server you are using. If you are using Apache, check the contents of httpd.conf and look at the values for User and Group. Some installations use different accounts for static data files (html, jpeg, shtml, etc.) and files that php is going to change. However, www-data appears to be correct for Ubuntu. Also, try to change owner (chown) for all of the files and directories in the directory structure used by WordPress, including the root directory.