Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #4900
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | "M. Strobel" <sorry_no_mail_here@nowhere.dee> |
| Newsgroups | comp.lang.php |
| Subject | Re: Do I still CLI version of PHP |
| Date | Sun, 19 Feb 2012 13:26:15 +0100 |
| Lines | 44 |
| Message-ID | <9qc837Fk21U1@mid.uni-berlin.de> (permalink) |
| References | <jhq7fr$8om$1@news.albasani.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de Ko4Uj7OFC8HxHhsU1Duxggb57Ma44KgvQzfUBSq4zuD6lWwx0= |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.26) Gecko/20120124 Thunderbird/3.1.18 |
| In-Reply-To | <jhq7fr$8om$1@news.albasani.net> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.php:4900 |
Show key headers only | View raw
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.
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
Do I still CLI version of PHP "sl@exabyte" <sb5309@hotmail.com> - 2012-02-19 15:13 +0800 Re: Do I still CLI version of PHP "J.O. Aho" <user@example.net> - 2012-02-19 10:05 +0100 Re: Do I still CLI version of PHP "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-19 13:26 +0100
csiph-web