an exe is a compiled set of code, specific to one operating system - to write an exe on the fly you'd need to read up on compilers, it's not a php question
the only solution i can think of is to have a compiler tool you can run from the command line, and execute it using php's [man]exec[/man] function
adam