If you need to, you can execute PHP from inside FM with Smartpill:
Else you need to make sure to configure IIS to be able to execute PHP scripts. You can find out more here:
I always host my PHP code on a separate web server that's already setup to run PHP. Just as I would for a website.
If you need to access FileMaker data via your PHP code, then you need to configure Custom Web Publishing.
Based on your script, I have no idea what your PHP code has to do with FileMaker.
wow! I should think the file could be read into a field in FM, replace the character(s) as needed an write it back out. PHP works, too, as do several other plugins...