PHP is almost certainly running as a different user than what you log in as.
Try chmod'ing the directory to be mode 777. Then it'll be world-writable. Be aware that anyone with a login on the server will be able change the contents of that directory.
If that doesn't work, contact your hosting provider / system administrator.
Think carefully about what you're doing. If this is an install script like you suggest, you're likely to end up installing things in the least secure manner possible.