Most answers are not exactly true or detailed... Don't forget safe_mode checks if the owner of the SCRIPT matches the owner of the file you want to access. It has nothing to do with the httpd user:group.
For example, your httpd could run as apache:daemon, your script owned by some_user:users and the file you want to right to some_other_user:users
If you don't activate safe_mode_gid, the script won't be able to access the file because users don't match.
This is a common phenomenon when a script creates a folder and then tries to create files inside this folder.
The folder creation succeeds because the parent folder is owned by the same user as the script creating it (most likely, it was uploaded by "some_user").
BUT, the created folder is now owned by the httpd user, let's say apache:daemon
If safe_mode is active, you won't be able to create a file inside this folder because the script owner (some_user) doesn't match the folder owner (apache).
Even if you activate safe_mode_gid, it won't work because the script group is "users" while the folder group is "daemon".
The best solution is to set the same group for ftp users and httpd.
Don't forget you have to allow write access to the group on the "writeable" folder too, and this is less secure because since all your users are in the same group, an httpd process could access the other users files since you activate safe_mode_gid.
You should in fact combine safe_mode_gid + open_basedir and set the home of the user as open_basedire value to avoid this.
HTH