Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

exec() cause an infinite loop of starting requested program

Tags:

php

OS: Linux.

WHM, cpanel used.

PHP 5.3.2 (cli) (built: Jun 11 2010 02:25:31) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

<?php
exec("php xyz.php");
?>

starts calling the xyz.php innumerable times. the server hangs after sometime.

calling 'php xyz.php' from the console works fine.

like image 360
Nandini Bhaduri Avatar asked Sep 01 '10 07:09

Nandini Bhaduri


People also ask

How do you make an infinite loop?

The infinite loop We can create an infinite loop using while statement. If the condition of while loop is always True , we get an infinite loop.

What happens when program runs in infinite loop?

What are infinite loops? An infinite loop is a piece of code that keeps running forever as the terminating condition is never reached. An infinite loop can crash your program or browser and freeze your computer.

What is an infinite loop give an example?

What is an Infinite Loop? An infinite loop occurs when a condition always evaluates to true. Usually, this is an error. For example, you might have a loop that decrements until it reaches 0.


1 Answers

found the solution from

http://www.mombu.com/php/php-5-forum/t-24759-exec-or-system-et-all-cause-an-infinite-loop-of-starting-requested-program-8469354.html

<?php
exec("php-cli xyz.php");
?>

worked....

like image 147
Nandini Bhaduri Avatar answered Nov 02 '22 20:11

Nandini Bhaduri