The Install Guide said to use 777 for directories and 666 for files, but said later below that it may need to be 755 and 644 respectively instead of 777 and 666.

I have now changed the permissions to 755 and 644, but upgrade.php still isn't working yet.