Isn't it more like public-facing app step one: Don't run user-supplied code? This in particular hardly seems to be a php issue. Sandboxing isn't trivial in most languages/environments.
Therefore I proclaim your point as step -1 ! :)
It'd be nice to see solutions like this entirely browser based. LLVM/asm.js?