On Wed, 04 Aug 2004 08:14:55 -0700, Jon Bertsch <[EMAIL PROTECTED]> wrote:
> 
> Hi all,
> 
> I have found a problem using the str_replace() function in PHP5. Over this
> past weekend we switched our production server to php5.0.0 running on
> apache 1.3.31 on SUSE9.1. Our development environment is identical. I have
> an application that runs a series of str_replace calls to drop in some
> document title and link information into an html string before sending it
> to the browser.
> 
> Code example:
> $html_string[0] = "<li><a
> href=\"read_docs.php?file=@@FISCAL_YEAR@@/@@month@@/393_@@TYPE@@.pdf&type=pdf&action=read\">GEP
> &amp; HIP Balances (GLC393)</a></li> ";
> 
> $html_output_1 .= $html_string[0];
> 
> $output = str_replace("@@FISCAL_YEAR@@", $this_year, $html_output_1 );
> 
> (I call it three times to do the replacements in the string).
> 
> This basically produces a list of documents with links to there location
> from a database call.
> 
> On our development box this little application runs fine. In production
> where our server is getting around 1 million hits a day (but the processor
> is rarely above 1% usage) this function completely fails. The page just
> doesn't get shown. If I comment out the calls to str_replace the html goes
> over perfectly with the @@TOKEN@@ instead of the necessary information. If
> I change the str_replace to say YEAR or FISCAL etc it makes no difference.
> 
> I dropped the production server to php 4.3.8 and the str_replace() function
> works exactly as expected and there are no problems loading the page. Bump
> back to php5.0.0 and it coughs again.
> 
> Has anyone else seen anything like this or does anyone have an explanation?
> I can recode the series of str_replace calls but now I'm somewhat worried
> that other solutions will also fail.
> 
> It seems to me like there's maybe a load tolerance bug in php5 when running
> str_replace() since I can't see this on our development box nor in 4.3.8.
> 
> The only difference in the functions between php4 and 5 is the addition of
> the count option, could that be the issue?
> 
> Any help or comments would be greatly appreciated.
> 

Sounds like a threading issue to me. PHP and Apache 2 don't always get
along unless you're using Apache2 in prefork mode. These things
usually don't show up except under heavy load (which it seems you
have). Check out the link below for more info:

https://www.reversefold.com/tikiwiki/tiki-index.php?page=PHPFAQs#id45260

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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

Reply via email to