instead of trying to change the set handler, to make a gif run as php why not use the htaccess to redirect to the php file while showing that its a gif. this would only work if you are able to use htaccess though, and it looks like you said you might not be able to.
example:
http://www.kastechnology.com/44487783.png
what it really goes to:
http://www.kastechnology.com/sig.php?id=44487783
code in the htaccess file:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([0-9]*)\.png$ /sig.php?id=$1 [NC]
you will obviously want to modify the htaccess because its used for a totally diffrent script and game so the information it needs is different(and its even a png instead of gif). if you dont know how to modify it to what you need let me know and i will. its just a simple regex so its nothing complicated.
EDIT: looks like this is basically what denvue posted, sorry i didnt read up a few posts.