Re: [PHP] str_replace() problem in PHP5 - anyone else?

2004-08-04 Thread Justin Patrin
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] = " href=\"read_docs.php?file=@@FISCAL_YEAR@@/@@month@@/393_@@TYPE@@.pdf&type=pdf&action=read\">GEP
> & HIP Balances (GLC393) ";
> 
> $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



Re: [PHP] str_replace() problem in PHP5 - anyone else?

2004-08-04 Thread Jon Bertsch
Jason,
Thanks for looking.
Very perplexing (to me at least).
Jon Bertsch
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] str_replace() problem in PHP5 - anyone else?

2004-08-04 Thread Curt Zirzow
* Thus wrote Jon Bertsch:
> ...
> 
> $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).
> 
> ...
> 
> 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'd wager that your script is dying because your probably running
out of memory that php is allowed to use:

 - Check the local value of php.ini:memory_limit
 - set error_reporting = E_ALL
 - ensure log_errors is on and check the logs
   or turn display_errors on


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] str_replace() problem in PHP5 - anyone else?

2004-08-04 Thread Jason Davidson
My mistake on $this_year.  


Jon Bertsch <[EMAIL PROTECTED]> wrote: 
> 
> 
> Jason,
> 
> This code is not using any OO the variable is $this_year  not $this->year.
> 
> Running it under php5 on my dev box the string replace function works and 
> replaces the text as expected.
> 
> Jon Bertsch
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP] str_replace() problem in PHP5 - anyone else?

2004-08-04 Thread Jon Bertsch
Jason,
This code is not using any OO the variable is $this_year  not $this->year.
Running it under php5 on my dev box the string replace function works and 
replaces the text as expected.

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


Re: [PHP] str_replace() problem in PHP5 - anyone else?

2004-08-04 Thread Jason Davidson
Yup, i understand not in php 5, there was some large OO changes in php
5, which is why i asked about $this->year. Ive been using php 5 for the
last year, and havent had a problem with str_replace, and have used it a
fair amount for loading email templates.   
So when you look at the source, the @@FISCAL_YERAR@@ is still in the
html lines?  str_replace did not do anything at all?

Jason

Jon Bertsch <[EMAIL PROTECTED]> wrote: 
> 
> 
> 
> Jason wrote:
>  >is it possbile $this->year isnt what you expect?
> 
> If I hard code the value it makes no difference and it works fine 
> in  php4.3.x and in dev just not on php5  with some load on the server. It 
> was tested on the same server before moving to live production and it 
> worked then as well.
> 
> Jon Bertsch
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP] str_replace() problem in PHP5 - anyone else?

2004-08-04 Thread Jon Bertsch

Jason wrote:
>is it possbile $this->year isnt what you expect?
If I hard code the value it makes no difference and it works fine 
in  php4.3.x and in dev just not on php5  with some load on the server. It 
was tested on the same server before moving to live production and it 
worked then as well.

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


Re: [PHP] str_replace() problem in PHP5 - anyone else?

2004-08-04 Thread Jason Davidson
is it possbile $this->year isnt what you expect? 
Jason

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] = " href=\"read_docs.php?file=@@FISCAL_YEAR@@/@@month@@/393_@@TYPE@@.pdf&type=pdf&action=read\">GEP
> 
> & HIP Balances (GLC393) ";
> 
> $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.
> 
> Thanks
> 
> Jon Bertsch
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



[PHP] str_replace() problem in PHP5 - anyone else?

2004-08-04 Thread Jon Bertsch
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] = "GEP 
& HIP Balances (GLC393) ";

$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.
Thanks
Jon Bertsch
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php