The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
exiting from script arghya_owen Shell Programming and Scripting 1 06-02-2008 07:36 AM
Exiting from script when error occurs Sreejith_VK Shell Programming and Scripting 4 04-25-2008 04:53 AM
Script Not Exiting??? lesstjm Shell Programming and Scripting 1 07-11-2007 12:58 PM
Shell script not exiting Gracefully smithK Shell Programming and Scripting 5 02-08-2007 06:48 PM
exiting in c ruffenator High Level Programming 3 04-28-2002 03:31 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-10-2007
Unbeliever Unbeliever is offline
Registered User
  
 

Join Date: Jul 2005
Location: England
Posts: 183
PHP5 Script 'Freeze' before exiting

I recently upgraded a system from php 4.4.2 to php 5.2.1, and one of my scripts has started behaving very strangely. I've tried google but come up blank so far.

Basically what the script does is select a large amount of data from a mysql (4.1.21) database, do some manipulation, the plots a graph (using jpgraph 2.2). I removed all the jpgraph code and am still getting the problem. What happens is the script 'hangs' for a period of time after executing the last php command before actually exiting. During this period of time the process takes up a large amount of CPU time (a whole single processor mostly) but if you truss the process you get no output until it finally exits (when you see stdin/out/err closed etc).

After putting various debug statements in I found that if I commented out the following line the script didn't hang before exiting.

$datax = $newdatax;

A pretty innocuous line. At this point $datax is a large array (many thousands of values long), and $newdatax an array with the results from parsing the original $datax in some way (mostly a case of taking every Nth entry from $datax). At this point I wish to throw away the original $datax and replace it with the new $newdatax and I may wish to do more maniplulation later.

If $datax is about 10000 or so rows there is a noticeable hang when the script exits, at 50000 rows the hang is over 20 seconds. Under php 4 I had no problems with this code when there were over 200,000 rows in the array.

Even if I simply change that line to

$datax = array();

I get similar (but much smaller) 'hang' before the script exits and the $datax array needs to be quite large before it becomes noticeable.

System is running on Solaris 9 on a v480 with 4 processors and 16GB of RAM. I've tried it with and without the Zend optimiser (v3.2.8) with no noticeable difference.

Any help appreciated.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0