The security problem arises when the Web server is granted permission to modify anything in the filesystem. The safe way to deal with this is to grant permission to the Web server to read/write only to a separate data directory, and not to the broader htdocs tree.
The best way to grant permission is to change the user or group ownership of the directory in question, and NOT to use mode 777 (which grants permission to all users). However, if you do not have root access, you may not be able to do that -- you can't change group ownership to a group of which you are not a member. And it is unlikely (but not impossible) that on a normally configured machine you will be a member of the same group as the Web server.
For CGI processes, it's possible for the root account to "wrap" a process so that it runs under a different user ID than the Web server. At my company, we do that as a matter of security policy. However, you do not have that option with PHP installed as a server module. This is not a limitation of PHP, but of the underlying security/operating system/Web server model.