# PHP socket server run as service

**URL:** <https://forum.kirupa.com/t/php-socket-server-run-as-service/326406>\
**Category:** programming\
**Created:** [December 12, 2011, 10:38am UTC](https://forum.kirupa.com/t/php-socket-server-run-as-service/326406 "2011-12-12T10:38:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunsetbros](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@sunsetbros](https://forum.kirupa.com/u/sunsetbros)\
**Post date:** [December 12, 2011, 10:38am UTC](https://forum.kirupa.com/t/php-socket-server-run-as-service/326406/1 "2011-12-12T10:38:43Z")

</div>

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/](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.
