I've had to roll with the PHP code (wish I had just used that in the first place rather than upgrading UE) to get this solution out to the client.
Downgrading to UE 3.0 did cause no end of problems though, especially with pages that I created with DFP and since updated when UE 4.0 was installed.
It made a right mess of things.
Note to others : If you start a project with a particular extension, stick with it for that project. Dont upgrade part way through, especially as extensions now seem to be getting 'bundled'.
No doubt you will hear from me on the next project I have to roll out with PHP on a windows box!