473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Please help: Error - Circular Redirection

Hi All

I would very much appreciate your help:
I have two scripts alternating in the background triggering themselves
mutually. Here is how:

1.)
Script A does something and then calls Script B through the header()
function. Using something like
header("Location:http//mydomain.com/scriptb.php");

2.)
Script B then does something as well and afterwards calls Script A
again also using the header() function.

After exactly 10 rounds my browser suddenly shows an PHP error message
which mentions a "circular redirection" error aborting the script.

QUESTION:
Is there a way to avoid that error?

PURPOSE:
The two-script-concept was supposed to be a solution to prevent
time-outs during time consuming processes by simply handing the
process over to another script before the time limit is reached thus
initiating a new script session by the other script which would
continue the process. In other words: The process is being kicked back
and forth between the two scripts until it's finished.

Any ideas ???? Thank you guys.
Jerry
Jul 17 '05 #1
5 1978
Jerry wrote:
After exactly 10 rounds my browser suddenly shows an PHP error message
which mentions a "circular redirection" error aborting the script. This is a protection so a script can't end in an endless redirection-loop.
Is there a way to avoid that error?

You could try meta-refreshs, but there could also be a configuration
directive, settings this.
Jul 17 '05 #2
Jerry <no**@none.com> wrote:
Hi All

I would very much appreciate your help:
I have two scripts alternating in the background triggering themselves
mutually. Here is how:

1.)
Script A does something and then calls Script B through the header()
function. Using something like
header("Location:http//mydomain.com/scriptb.php");

2.)
Script B then does something as well and afterwards calls Script A
again also using the header() function.

After exactly 10 rounds my browser suddenly shows an PHP error message
which mentions a "circular redirection" error aborting the script.

QUESTION:
Is there a way to avoid that error?

PURPOSE:
The two-script-concept was supposed to be a solution to prevent
time-outs during time consuming processes by simply handing the
process over to another script before the time limit is reached thus
initiating a new script session by the other script which would
continue the process. In other words: The process is being kicked back
and forth between the two scripts until it's finished.

Any ideas ???? Thank you guys.
Jerry


Ouch! Why not just change the timeout setting in php.ini?
--
Ray Morgan
http://Fares-Fair.com/
Jul 17 '05 #3
When I do a long-running process on a shared server, I find that if I issue
a short 'sleep' call ever few seconds, I can run a process for a long time
(hours and even days), even though I'm running on a server in which there is
a 30-second timeout for runaway processes.

The 'sleep' is a way to yield the processor, giving other processes a chance
to run.

So you might simplify your processing in this way, using a single PHP
script, rather than flipping back and forth between two pages. It should be
easier for you to write, and might even impose less load on your server.

--
--------------------
My e-mail address doesn't have a 2 in it.
"Christian Fersch" <Ch******@web.de> wrote in message
news:c9*************@news.t-online.com...
Jerry wrote:
After exactly 10 rounds my browser suddenly shows an PHP error message
which mentions a "circular redirection" error aborting the script.

This is a protection so a script can't end in an endless redirection-loop.
Is there a way to avoid that error?

You could try meta-refreshs, but there could also be a configuration
directive, settings this.

Jul 17 '05 #4
if you just want the script to run without dying, but you don't care about
seeing the end-result in the browser you can...
<?
function this_function()
{
// do a bunch of wacky stuff here...
}
?>

or.. if you want to see something in the browser.. you can do something like
this. (This is from actual working code I wrote a long time ago... i
trimmed out the stuff specific to my application but you should get the
idea...)
<?
set_time_limit(0);
session_start();

// the setup...
if (!isset($_SESSION['count'])) {

$_SESSION['count'] = 0;

$_SESSION['chunks'] = array_chunk(file('/some/file.txt), 50);

$_SESSION['start_time'] = date("Y-m-d H:i:s");
$_SESSION['chunk_count'] = count($_SESSION['chunks']);

header('Location: ' . $_SERVER['PHP_SELF']);
exit();

// the run through
} else {

++$_SESSION['count'];

echo 'Start Time: ' . $_SESSION['start_time'] . '<br />';
echo 'Pass: ' . $_SESSION['count'] . ' of ' .
$_SESSION['chunk_count'] . '<br />';

if (isset($_SESSION['chunks'][0])) {

foreach ($_SESSION['chunks'][0] as $k => $v) {

$line = trim($v);

//
// your code to do something with the line goes here.
//

} // END foreach loop

array_shift($_SESSION['chunks']);
echo '<META HTTP-EQUIV="REFRESH" CONTENT="0; url=' .
$_SERVER['PHP_SELF'] . '">';

} else {

// must be done! Display the results.
$_SESSION['end_time'] = date("Y-m-d H:i:s");

echo '<pre>';
print_r($_SESSION);
echo '</pre>';

}

}

?>
"Jerry" <no**@none.com> wrote in message
news:un********************************@4ax.com...
Hi All

I would very much appreciate your help:
I have two scripts alternating in the background triggering themselves
mutually. Here is how:

1.)
Script A does something and then calls Script B through the header()
function. Using something like
header("Location:http//mydomain.com/scriptb.php");

2.)
Script B then does something as well and afterwards calls Script A
again also using the header() function.

After exactly 10 rounds my browser suddenly shows an PHP error message
which mentions a "circular redirection" error aborting the script.

QUESTION:
Is there a way to avoid that error?

PURPOSE:
The two-script-concept was supposed to be a solution to prevent
time-outs during time consuming processes by simply handing the
process over to another script before the time limit is reached thus
initiating a new script session by the other script which would
continue the process. In other words: The process is being kicked back
and forth between the two scripts until it's finished.

Any ideas ???? Thank you guys.
Jerry

Jul 17 '05 #5
Hello People!

Thank you so far. I will try your suggestions.
Nevertheless, I'm afraid the problem persists because I would need a
solution which allows me to close the browser once the process has
been triggered. Any ideas on this?
Your help is greatly appreciated.
Jerry

On Fri, 04 Jun 2004 18:11:10 +0200, Jerry <no**@none.com> wrote:
Hi All

I would very much appreciate your help:
I have two scripts alternating in the background triggering themselves
mutually. Here is how:

1.)
Script A does something and then calls Script B through the header()
function. Using something like
header("Location:http//mydomain.com/scriptb.php");

2.)
Script B then does something as well and afterwards calls Script A
again also using the header() function.

After exactly 10 rounds my browser suddenly shows an PHP error message
which mentions a "circular redirection" error aborting the script.

QUESTION:
Is there a way to avoid that error?

PURPOSE:
The two-script-concept was supposed to be a solution to prevent
time-outs during time consuming processes by simply handing the
process over to another script before the time limit is reached thus
initiating a new script session by the other script which would
continue the process. In other words: The process is being kicked back
and forth between the two scripts until it's finished.

Any ideas ???? Thank you guys.
Jerry


Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Piotr Sawuk | last post by:
I'm a newbie in the world of c++, and I am used to learn a programming language simply by programming. Unfortunately I where unable to find any useful helpfile for this language, in which such...
1
by: Robert Cholewa | last post by:
Hi I'm using Microsoft.XMLHTTP object from within JavaScript HTA application (or WScript). Object is set to use asynchronous mode as following: --------- var oXMLRequest = new...
4
by: Tiraman | last post by:
Hi , Problem description : I have 2 assemblies (A.dll And B.dll) . They are both under the GAC and they are both using the functions of each other . Each time that I m doing a change in...
1
by: charmeda103 | last post by:
here are the error messages how do i fix it. i am creating the game called Circular Nim! my program also keeps repeating why. anything would help! 1.error C2234: 'GamePieces' : arrays of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.