|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
The following PHP code causes Apache to crash and PHP to suspend: a() ; function a(){return a();} This is running EasyPHP under Vista. How to fix? Thanks, P. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote:
> The following PHP code causes Apache to crash and PHP to suspend: > > a() ; function a(){return a();} > > This is running EasyPHP under Vista. > > How to fix? > > Thanks, > > P. Ummm, don't try to run an infinite loop? |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Feb 9, 1:21pm, ZeldorBlat <zeldorb...@gmail.com> wrote:
> On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote: > > > The following PHP code causes Apache to crash and PHP to suspend: > > > a() ; function a(){return a();} > > > This is running EasyPHP under Vista. > > > How to fix? > > > Thanks, > > > P. > > Ummm, don't try to run an infinite loop? Solve Turing's Unsolvability of the Halting Problem! Would it be easier to fix Apache? P. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote:
> On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote: > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote: > > > > The following PHP code causes Apache to crash and PHP to suspend: > > > > a() ; function a(){return a();} > > > > This is running EasyPHP under Vista. > > > > How to fix? > > > > Thanks, > > > > P. > > > Ummm, don't try to run an infinite loop? > > Solve Turing's Unsolvability of the Halting Problem! > > Would it be easier to fix Apache? > > P. couple of things: 1) add a usleep(1) or something to give the CPU a rest within the infinite loop. 2) increase the max execution time 3... choose a more appropriate language for what you are trying to do lol |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Feb 10, 5:08am, GarethAtFlignet <garethinwa...@googlemail.com>
wrote: > On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > > > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote: > > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > The following PHP code causes Apache to crash and PHP to suspend: > > > > > a() ; function a(){return a();} > > > > > This is running EasyPHP under Vista. > > > > > How to fix? > > > > > Thanks, > > > > > P. > > > > Ummm, don't try to run an infinite loop? > > > Solve Turing's Unsolvability of the Halting Problem! > > > Would it be easier to fix Apache? > > > P. > > couple of things: > > 1) add a usleep(1) or something to give the CPU a rest within the > infinite loop. > 2) increase the max execution time > > 3... choose a more appropriate language for what you are trying to do > lol- Hide quoted text - 4) Get a stack error (instead of crashing Apache)? > - Show quoted text - |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On 10 Feb, 14:45, PHPBABY3 <shymath...@gmail.com> wrote:
> On Feb 10, 5:08 am, GarethAtFlignet <garethinwa...@googlemail.com> > wrote: > > > > > On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote: > > > > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote: > > > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > > The following PHP code causes Apache to crash and PHP to suspend: > > > > > > a() ; function a(){return a();} > > > > > > This is running EasyPHP under Vista. > > > > > > How to fix? > > > > > > Thanks, > > > > > > P. > > > > > Ummm, don't try to run an infinite loop? > > > > Solve Turing's Unsolvability of the Halting Problem! > > > > Would it be easier to fix Apache? > > > > P. > > > couple of things: > > > 1) add a usleep(1) or something to give the CPU a rest within the > > infinite loop. > > 2) increase the max execution time > > > 3... choose a more appropriate language for what you are trying to do > > lol- Hide quoted text - > > 4) Get a stack error (instead of crashing Apache)? > > > - Show quoted text - Don't have a windows based PHP system to test on sorry, but at least you now know why Apache is barfing ![]() Try this... <?php set_time_limit ( 0 ); ignore_user_abort ( ); a(); function a(){ echo memory_get_usage()."\n"; return a(); } ?> shows memory getting eaten up each loop (but not that much).. probably a question for someone who knows the internals of PHP and how it reacts to recursive calls. Seems to barf after around 32k recursive calls... You don't get this problem with an infinite loop. |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On 10 Feb, 18:46, GarethAtFlignet <garethinwa...@googlemail.com>
wrote: > On 10 Feb, 14:45, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > On Feb 10, 5:08 am, GarethAtFlignet <garethinwa...@googlemail.com> > > wrote: > > > > On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote: > > > > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > > > The following PHP code causes Apache to crash and PHP to suspend: > > > > > > > a() ; function a(){return a();} > > > > > > > This is running EasyPHP under Vista. > > > > > > > How to fix? > > > > > > > Thanks, > > > > > > > P. > > > > > > Ummm, don't try to run an infinite loop? > > > > > Solve Turing's Unsolvability of the Halting Problem! > > > > > Would it be easier to fix Apache? > > > > > P. > > > > couple of things: > > > > 1) add a usleep(1) or something to give the CPU a rest within the > > > infinite loop. > > > 2) increase the max execution time > > > > 3... choose a more appropriate language for what you are trying to do > > > lol- Hide quoted text - > > > 4) Get a stack error (instead of crashing Apache)? > > > > - Show quoted text - > > Don't have a windows based PHP system to test on sorry, but at least > you now know why Apache is barfing ![]() > > Try this... > > <?php > set_time_limit ( 0 ); > ignore_user_abort ( ); > > a(); > function a(){ > echo memory_get_usage()."\n"; > return a(); > > } > > ?> > > shows memory getting eaten up each loop (but not that much).. probably > a question for someone who knows the internals of PHP and how it > reacts to recursive calls. Seems to barf after around 32k recursive > calls... > > You don't get this problem with an infinite loop. Oops sorry, quite easy to see whats the problem really. return a() calls the function a() and attempts to return the results which in turn creates another call to a() and so on. Therefore this will eat up resources each recursion and therefore fail. Maybe this would work better in a language that doesn't perform runtime interpretation. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
On Feb 10, 1:51pm, GarethAtFlignet <garethinwa...@googlemail.com>
wrote: > On 10 Feb, 18:46, GarethAtFlignet <garethinwa...@googlemail.com> > wrote: > > > > > > > On 10 Feb, 14:45, PHPBABY3 <shymath...@gmail.com> wrote: > > > > On Feb 10, 5:08 am, GarethAtFlignet <garethinwa...@googlemail.com> > > > wrote: > > > > > On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote: > > > > > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > > > > The following PHP code causes Apache to crash and PHP to suspend: > > > > > > > > a() ; function a(){return a();} > > > > > > > > This is running EasyPHP under Vista. > > > > > > > > How to fix? > > > > > > > > Thanks, > > > > > > > > P. > > > > > > > Ummm, don't try to run an infinite loop? > > > > > > Solve Turing's Unsolvability of the Halting Problem! > > > > > > Would it be easier to fix Apache? > > > > > > P. > > > > > couple of things: > > > > > 1) add a usleep(1) or something to give the CPU a rest within the > > > > infinite loop. > > > > 2) increase the max execution time > > > > > 3... choose a more appropriate language for what you are trying to do > > > > lol- Hide quoted text - > > > > 4) Get a stack error (instead of crashing Apache)? > > > > > - Show quoted text - > > > Don't have a windows based PHP system to test on sorry, but at least > > you now know why Apache is barfing ![]() > > > Try this... > > > <?php > > set_time_limit ( 0 ); > > ignore_user_abort ( ); > > > a(); > > function a(){ > > echo memory_get_usage()."\n"; > > return a(); > > > } > > > ?> > > > shows memory getting eaten up each loop (but not that much).. probably > > a question for someone who knows the internals of PHP and how it > > reacts to recursive calls. Seems to barf after around 32k recursive > > calls... > > > You don't get this problem with an infinite loop. > > Oops sorry, quite easy to see whats the problem really. return a() > calls the function a() and attempts to return the results which in > turn creates another call to a() and so on. Therefore this will eat up > resources each recursion and therefore fail. Silly, the program should bomb, not Apache. > Maybe this would work > better in a language that doesn't perform runtime interpretation.- Hide quoted text - > > - Show quoted text - |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
On Feb 10, 11:49 pm, PHPBABY3 <shymath...@gmail.com> wrote:
> On Feb 10, 1:51 pm, GarethAtFlignet <garethinwa...@googlemail.com> > wrote: > > > > > On 10 Feb, 18:46, GarethAtFlignet <garethinwa...@googlemail.com> > > wrote: > > > > On 10 Feb, 14:45, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > On Feb 10, 5:08 am, GarethAtFlignet <garethinwa...@googlemail.com> > > > > wrote: > > > > > > On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > > > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote: > > > > > > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > > > > > The following PHP code causes Apache to crash and PHP to suspend: > > > > > > > > > a() ; function a(){return a();} > > > > > > > > > This is running EasyPHP under Vista. > > > > > > > > > How to fix? > > > > > > > > > Thanks, > > > > > > > > > P. > > > > > > > > Ummm, don't try to run an infinite loop? > > > > > > > Solve Turing's Unsolvability of the Halting Problem! > > > > > > > Would it be easier to fix Apache? > > > > > > > P. > > > > > > couple of things: > > > > > > 1) add a usleep(1) or something to give the CPU a rest within the > > > > > infinite loop. > > > > > 2) increase the max execution time > > > > > > 3... choose a more appropriate language for what you are trying to do > > > > > lol- Hide quoted text - > > > > > 4) Get a stack error (instead of crashing Apache)? > > > > > > - Show quoted text - > > > > Don't have a windows based PHP system to test on sorry, but at least > > > you now know why Apache is barfing ![]() > > > > Try this... > > > > <?php > > > set_time_limit ( 0 ); > > > ignore_user_abort ( ); > > > > a(); > > > function a(){ > > > echo memory_get_usage()."\n"; > > > return a(); > > > > } > > > > ?> > > > > shows memory getting eaten up each loop (but not that much).. probably > > > a question for someone who knows the internals of PHP and how it > > > reacts to recursive calls. Seems to barf after around 32k recursive > > > calls... > > > > You don't get this problem with an infinite loop. > > > Oops sorry, quite easy to see whats the problem really. return a() > > calls the function a() and attempts to return the results which in > > turn creates another call to a() and so on. Therefore this will eat up > > resources each recursion and therefore fail. > > Silly, the program should bomb, not Apache. > > > Maybe this would work > > better in a language that doesn't perform runtime interpretation.- Hide quoted text - > > > - Show quoted text - The program does bomb (run it from the command prompt). Under linux apache itself doesnt fail. Maybe something to do with the Windows version/distro of PHP/Apache you are using. |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
On Feb 11, 4:38am, GarethAtFlignet <garethinwa...@googlemail.com>
wrote: > On Feb 10, 11:49 pm, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > > > On Feb 10, 1:51 pm, GarethAtFlignet <garethinwa...@googlemail.com> > > wrote: > > > > On 10 Feb, 18:46, GarethAtFlignet <garethinwa...@googlemail.com> > > > wrote: > > > > > On 10 Feb, 14:45, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > > On Feb 10, 5:08 am, GarethAtFlignet <garethinwa...@googlemail.com> > > > > > wrote: > > > > > > > On 9 Feb, 22:04, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > > > > On Feb 9, 1:21 pm, ZeldorBlat <zeldorb...@gmail.com> wrote: > > > > > > > > > On Feb 9, 11:05 am, PHPBABY3 <shymath...@gmail.com> wrote: > > > > > > > > > > The following PHP code causes Apache to crash and PHP to suspend: > > > > > > > > > > a() ; function a(){return a();} > > > > > > > > > > This is running EasyPHP under Vista. > > > > > > > > > > How to fix? > > > > > > > > > > Thanks, > > > > > > > > > > P. > > > > > > > > > Ummm, don't try to run an infinite loop? > > > > > > > > Solve Turing's Unsolvability of the Halting Problem! > > > > > > > > Would it be easier to fix Apache? > > > > > > > > P. > > > > > > > couple of things: > > > > > > > 1) add a usleep(1) or something to give the CPU a rest within the > > > > > > infinite loop. > > > > > > 2) increase the max execution time > > > > > > > 3... choose a more appropriate language for what you are trying to do > > > > > > lol- Hide quoted text - > > > > > > 4) Get a stack error (instead of crashing Apache)? > > > > > > > - Show quoted text - > > > > > Don't have a windows based PHP system to test on sorry, but at least > > > > you now know why Apache is barfing ![]() > > > > > Try this... > > > > > <?php > > > > set_time_limit ( 0 ); > > > > ignore_user_abort ( ); > > > > > a(); > > > > function a(){ > > > > echo memory_get_usage()."\n"; > > > > return a(); > > > > > } > > > > > ?> > > > > > shows memory getting eaten up each loop (but not that much).. probably > > > > a question for someone who knows the internals of PHP and how it > > > > reacts to recursive calls. Seems to barf after around 32k recursive > > > > calls... > > > > > You don't get this problem with an infinite loop. > > > > Oops sorry, quite easy to see whats the problem really. return a() > > > calls the function a() and attempts to return the results which in > > > turn creates another call to a() and so on. Therefore this will eat up > > > resources each recursion and therefore fail. > > > Silly, the program should bomb, not Apache. > > > > Maybe this would work > > > better in a language that doesn't perform runtime interpretation.- Hide quoted text - > > > > - Show quoted text - > > The program does bomb (run it from the command prompt). Under linux > apache itself doesnt fail. Maybe something to do with the Windows > version/distro of PHP/Apache you are using. Oh! I read that this bug in PHP has existed for years, and the developers always refused to fix it. I didn' read where it has been fixed under Linux. (I'm surprised the OS makes a difference - not real good.) I wonder if they'll get to Windows? I can see where their heart is! : ) P. > Hide quoted text - > > - Show quoted text - |
|
![]() |
| Outils de la discussion | |
|
|