How to run a php file forever in ubuntu by command line


I am using web-socket in php to run a chat service problem is when i close the command line the connection also close , is there a solution so that the chat service can run forever . i am using this command

php -q server.php

create a php file on your server name it as start_server.php and post this content


            $shell_command = "php -q server.php > /dev/null &";


now execute this command

php start_server.php