PHP socket server run as service

I have created the PHP socket server and started that in localhost ( 127.0.0.1) through command prompt. i.e

  C:\xampp\php\php server.php

this working fine in localhost.but my problem is i have to run this server.php file in the domain server. i have copied the server.php file to the web host directory (http://example.com/) and changed the ip address to the domain ip address in php file. Now the problem is when i run the file in the browser like

 http://www.example.com/server.php      

the socket server starts fine and within 5 minutes it automatically stopped by the browser.
how can i run that server.php file through command prompt. help needed.

thanks.