ISAPI Stack Overflow?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
llfitness
Forum Newbie
Posts: 12
Joined: Mon Feb 20, 2006 3:28 pm

ISAPI Stack Overflow?

Post by llfitness »

It was suggested to me that I should try to move from PHP-CGI to PHP-ISAPI because it was faster / better... I set up a test site to see whether it was stable but I've been getting stack overflow errors. Is this a common problem or have I done something horribly wrong?

IIS 6 / Windows 2003 / PHP 5.1.2

Johnathon Wright
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Is this code specific or does it affect all of your scripts?
User avatar
llfitness
Forum Newbie
Posts: 12
Joined: Mon Feb 20, 2006 3:28 pm

Hard to say...

Post by llfitness »

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Since I'm just testing to make sure that switching won't cause a disaster, I'm only running one website with it, so it's hard to say. 

My guess based on very limited troubleshooting that it's specific to some recursive code I wrote.... I'm fairly certain that the code is correct, as it has worked under PHP-CGI for a while and I remember that when I wrote it I was fairly careful with it.

This code assumes that there are no recursive tree structures in the category list... and I am certain that there are not any.

Code: Select all

function recursive_verify($target_category, $search_category)
	{
	global $db;
	// This function accepts two category IDs and searches from the
	// second category ID to the root of the tree for the first 
	// main_category, recursively. Returns 0 if they do not meet. 
	// Returns > 0 if they do.
	
	if ($target_category != $search_category)
		{
		$look_up_sql = "
			SELECT
				top_category
			FROM
				category_to_category
			WHERE
				sub_category = '" . $search_category . "'";
			
		$look_up_set = $db->GetAll($look_up_sql);
		
		if ($look_up_set === FALSE)
			{
			general_error_v1('CLASSES/custom_tools/nested_category_functions.php', 'db', $look_up_sql, $db->ErrorMsg(), 'TRUE');
			}
		elseif (count($look_up_set) == 0)
			{
			return 0;
			}

		$hit = 0;
		
		foreach($look_up_set as $look_up_info)
			{
			trigger_error("Recursive Verify is looking for this category in " . $look_up_info['top_category'], E_USER_NOTICE);
			$hit = max($hit, recursive_verify($target_category, $look_up_info['top_category']));
			}
		return $hit;
		}  // END if this IS NOT the end of the line
	else
		{ // we've found the root for which we were looking.
		return $target_category;
		}
	}

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply