FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Do I still CLI version of PHP
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Do I still CLI version of PHP [message #177083 is a reply to message #177081] Sun, 19 February 2012 12:26 Go to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 19.02.2012 08:13, schrieb sl@exabyte:
> On my webserver:
> *PHP version is 5.3.6
> *server API: CGI/FastCGI
>
> I need to run a socket server. A sample snippet is below:
>
> #!/usr/local/bin/php -q
>
> <?php
>
> //file name: server_socket.php
>
> .....
>
> while (true) { // Loop continuously
>
> // Setup clients listen socket for reading
>
> $read[0] = $sock;
>
---cut

>
>
> Questions:
>
> 1. Do still need the line '#!/usr/local/bin/php -q' is I call the file via
> http, eg http://domain/server_socket.php, because the program is looping ?
>
> 2. If the answer to Q1is yes, how do I run my server program (I think the
> version on my server is CGI) ?
>
> Thanks

AFAIK you would never run a service, especially not a PHP service, in the web server.

In the web server normal operation is Request -> Script start -> script output ->
script end ->end of request. Long running scripts are abuse.

Either run your script as true daemon, or use a "ad hoc daemon" solution like running
your script in "screen", or starting it with "nohup".

/Str.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Mail() function not working in PHP5
Next Topic: photo gallery
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 23:33:03 GMT 2024

Total time taken to generate the page: 0.04955 seconds