Re: [PHP] Re: [Bulk] Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?

2009-06-13 Thread Ashley Sheridan
On Thu, 2009-06-11 at 20:52 +0200, Jean-Pierre Arneodo wrote:
 Ashley Sheridan a écrit :
  On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote:

  Hi!
  I'm stuck.
  I don't understand why the php CLI dies after 3 hours in my script.
  Any idea to solve?
  Thanks
 
 
  PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr  7 2009 
  20:06:36)
  Linux ubuntu  2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 x86_64 
  GNU/Linux
 
  Conf [php.ini]
  max_execution_time=0
 
  ?php
  while (true) {
  sleep(5);
  }
  ?
 
 

  
  The while loop will continue executing until its condition is false. As
  you've got a boolean true as the condition, it will never end.
 
  Thanks
  Ash
  www.ashleysheridan.co.uk

 I don't want to stop, but the process dies.
 
 I've tried the same loop with bash interpretor.
 Same result, it seems to be a ubuntu problem, not a php problem.
 
 Thanks
 
 
 
Why do you want the process to continue indefinitely? Is it for a daemon
of some kind?

Thanks
Ash
www.ashleysheridan.co.uk


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [Bulk] Re: [PHP] Re: [Bulk] Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?

2009-06-13 Thread Jean-Pierre Arneodo

Ashley Sheridan a écrit :

On Thu, 2009-06-11 at 20:52 +0200, Jean-Pierre Arneodo wrote:
  

Ashley Sheridan a écrit :


On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote:
  
  

Hi!
I'm stuck.
I don't understand why the php CLI dies after 3 hours in my script.
Any idea to solve?
Thanks


PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr  7 2009 
20:06:36)
Linux ubuntu  2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 x86_64 
GNU/Linux

Conf [php.ini]
max_execution_time=0

?php
while (true) {
sleep(5);
}
?


  



The while loop will continue executing until its condition is false. As
you've got a boolean true as the condition, it will never end.

Thanks
Ash
www.ashleysheridan.co.uk
  
  

I don't want to stop, but the process dies.

I've tried the same loop with bash interpretor.
Same result, it seems to be a ubuntu problem, not a php problem.

Thanks





Why do you want the process to continue indefinitely? Is it for a daemon
of some kind?

Thanks
Ash
www.ashleysheridan.co.uk

  
No, it isn't a daemon, but it does something and wait the end of 
processing by polling a daemon.


# ulimit -a
core file size  (blocks, -c) 0
data seg size   (kbytes, -d) unlimited
scheduling priority (-e) 0
file size   (blocks, -f) unlimited
pending signals (-i) 38912
max locked memory   (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files  (-n) 1024
pipe size(512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority  (-r) 0
stack size  (kbytes, -s) 8192
cpu time   (seconds, -t) unlimited
max user processes  (-u) 38912
virtual memory  (kbytes, -v) unlimited
file locks  (-x) unlimited




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?

2009-06-11 Thread Ashley Sheridan
On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote:
 Hi!
 I'm stuck.
 I don't understand why the php CLI dies after 3 hours in my script.
 Any idea to solve?
 Thanks
 
 
 PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr  7 2009 
 20:06:36)
 Linux ubuntu  2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 x86_64 
 GNU/Linux
 
 Conf [php.ini]
 max_execution_time=0
 
 ?php
 while (true) {
 sleep(5);
 }
 ?
 
 
   
The while loop will continue executing until its condition is false. As
you've got a boolean true as the condition, it will never end.

Thanks
Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?

2009-06-11 Thread Ford, Mike
On 11 June 2009 12:00, Ashley Sheridan advised:

 On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote:
 Hi!
 I'm stuck.
 I don't understand why the php CLI dies after 3 hours in my script.
Any
 idea to solve? Thanks
 
 
 PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr  7
2009
 20:06:36) Linux ubuntu  2.6.24-19-server #1 SMP Wed Jun 18 14:44:47
UTC
 2008 x86_64 GNU/Linux 
 
 Conf [php.ini]
 max_execution_time=0
 
 ?php
 while (true) {
 sleep(5);
 }
 
 
 
 
 The while loop will continue executing until its condition is false.
As
 you've got a boolean true as the condition, it will never end.

I think he realises that. His question is why never equates to 3 hours
in his environment.

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: m.f...@leedsmet.ac.uk
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?

2009-06-11 Thread Eddie Drapkin
try set_time_limit(0) ?

On Thu, Jun 11, 2009 at 8:05 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote:

 On 11 June 2009 12:00, Ashley Sheridan advised:

  On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote:
  Hi!
  I'm stuck.
  I don't understand why the php CLI dies after 3 hours in my script.
 Any
  idea to solve? Thanks
 
 
  PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr  7
 2009
  20:06:36) Linux ubuntu  2.6.24-19-server #1 SMP Wed Jun 18 14:44:47
 UTC
  2008 x86_64 GNU/Linux
 
  Conf [php.ini]
  max_execution_time=0
 
  ?php
  while (true) {
  sleep(5);
  }
 
 
 
 
  The while loop will continue executing until its condition is false.
 As
  you've got a boolean true as the condition, it will never end.

 I think he realises that. His question is why never equates to 3 hours
 in his environment.

 Cheers!

 Mike

  --
 Mike Ford,  Electronic Information Developer,
 C507, Leeds Metropolitan University, Civic Quarter Campus,
 Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
 Email: m.f...@leedsmet.ac.uk
 Tel: +44 113 812 4730


 To view the terms under which this email is distributed, please go to
 http://disclaimer.leedsmet.ac.uk/email.htm

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?

2009-06-11 Thread Robert Cummings

Ford, Mike wrote:

On 11 June 2009 12:00, Ashley Sheridan advised:


On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote:

Hi!
I'm stuck.
I don't understand why the php CLI dies after 3 hours in my script.

Any

idea to solve? Thanks


PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr  7

2009

20:06:36) Linux ubuntu  2.6.24-19-server #1 SMP Wed Jun 18 14:44:47

UTC
2008 x86_64 GNU/Linux 


Conf [php.ini]
max_execution_time=0

?php
while (true) {
sleep(5);
}



The while loop will continue executing until its condition is false.

As

you've got a boolean true as the condition, it will never end.


I think he realises that. His question is why never equates to 3 hours
in his environment.


Shouldn't be max execution time issue if he's running the CLI. Maybe 
account limits? Maybe the above snippet isn't what's really happening... 
I mean what purpose would the above script serve for 3 hours? Looks like 
it's been dumbed down for us dummies on the list.


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?

2009-06-11 Thread kyle.smith
One of two things is happening:

- PHP is crashing, maybe a memory leak, etc.

Or

- That while(true) loop is exiting, and the script is completing.

Would be interesting to know which, try adding this after the loop:
$fp = fopen('/tmp/test','w');
fputs($fp, 'My script left the loop and exited cleanly.  True ==
false.');
fclose($fp);
 
Back on my first point, have you kept an eye on the memory usage over
the 3 hours?  If your version of PHP has a memory leak with while() or
sleep() (would be odd), a bazillion iterrations could break the PHP
defined memory limit (8M by default) and cause it to exit abruptly.

Are you capturing the output anywhere?  For example, in Linux is it
being run from cron or another script?  Try redirecting STDOUT and
STDERR somewhere useful, i.e.:

php my_php_script  /tmp/scriptoutput 21

(21 means output stream 2 [stderr] to the same place as stream 1)

Hope any of these crazy ideas are helpful...
- Kyle

 
--
Kyle Smith
Unix Systems Administrator

-Original Message-
From: Robert Cummings [mailto:rob...@interjinn.com] 
Sent: Thursday, June 11, 2009 8:25 AM
To: Ford, Mike
Cc: php-general@lists.php.net
Subject: Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?

Ford, Mike wrote:
 On 11 June 2009 12:00, Ashley Sheridan advised:
 
 On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote:
 Hi!
 I'm stuck.
 I don't understand why the php CLI dies after 3 hours in my script.
 Any
 idea to solve? Thanks


 PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr  7
 2009
 20:06:36) Linux ubuntu  2.6.24-19-server #1 SMP Wed Jun 18 14:44:47
 UTC
 2008 x86_64 GNU/Linux

 Conf [php.ini]
 max_execution_time=0

 ?php
 while (true) {
 sleep(5);
 }


 The while loop will continue executing until its condition is false.
 As
 you've got a boolean true as the condition, it will never end.
 
 I think he realises that. His question is why never equates to 3 
 hours in his environment.

Shouldn't be max execution time issue if he's running the CLI. Maybe
account limits? Maybe the above snippet isn't what's really happening...

I mean what purpose would the above script serve for 3 hours? Looks like
it's been dumbed down for us dummies on the list.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: [Bulk] Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?

2009-06-11 Thread Jean-Pierre Arneodo

Ashley Sheridan a écrit :

On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote:
  

Hi!
I'm stuck.
I don't understand why the php CLI dies after 3 hours in my script.
Any idea to solve?
Thanks


PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr  7 2009 
20:06:36)
Linux ubuntu  2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 x86_64 
GNU/Linux

Conf [php.ini]
max_execution_time=0

?php
while (true) {
sleep(5);
}
?


  


The while loop will continue executing until its condition is false. As
you've got a boolean true as the condition, it will never end.

Thanks
Ash
www.ashleysheridan.co.uk
  

I don't want to stop, but the process dies.

I've tried the same loop with bash interpretor.
Same result, it seems to be a ubuntu problem, not a php problem.

Thanks



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: [Bulk] Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?

2009-06-11 Thread Robert Cummings

Jean-Pierre Arneodo wrote:

Ashley Sheridan a écrit :

On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote:
 

Hi!
I'm stuck.
I don't understand why the php CLI dies after 3 hours in my script.
Any idea to solve?
Thanks


PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr  7 
2009 20:06:36)
Linux ubuntu  2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 
x86_64 GNU/Linux


Conf [php.ini]
max_execution_time=0

?php
while (true) {
sleep(5);
}
?


  

The while loop will continue executing until its condition is false. As
you've got a boolean true as the condition, it will never end.

Thanks
Ash
www.ashleysheridan.co.uk
  

I don't want to stop, but the process dies.

I've tried the same loop with bash interpretor.
Same result, it seems to be a ubuntu problem, not a php problem.


Open up a shell... type the following into it:

ulimit -a

What do you see?

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php