a few more tests and this is the results.
php executes fine from the command line and outputs the correct html file.
but thru apache if you try and use a browser to access the file it prompts you to download it and the server doesn't execute it.
I am lost atm so any help would be appreciated. (I will keep looking and let you know if I work it out)