I think your slightly confused here. When you ran Firefox from the cli you ran it from the machine you were running it on. however if you put that command on a web page. that does not get executed on the client! What happens is the client will request that page and execute on the server. which is a dangerous thing to do and should be only done if necessary and under the tightest security and also is unsuitable for running any GUI commands. so putting exec("DISPLAY=:0.0 firefox") is completely wrong.
So the question you ask is how do you execute the command on the client then?
The answer is you can't under normal circumstances. Fortunately for opening a window you don't need to
. you can use the window.open function in javascript. which will open a new browser window or use the target attribute on links
Be careful if you use window.open though, many browsers will block this as its considered to be annoying popup