PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 5th, 2013, 06:16 PM
Penicillin Penicillin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 231 Penicillin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 10 h 31 m 40 sec
Reputation Power: 0
PHP5 - PHP while loop issue

I have PHP script contains a long loop to list about 60,000 email addresses from mysql, but after 30,000, my php script stops working and brakes, and sometimes all php script is written in white page (my page has imaged background), I increased PHP memory limit to unlimited and set max_execution_time to 0, but no help.

My server has 2GB RAM.

What's problem?

Reply With Quote
  #2  
Old January 5th, 2013, 06:49 PM
portcitysoftwar portcitysoftwar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 163 portcitysoftwar User rank is Sergeant (500 - 2000 Reputation Level)portcitysoftwar User rank is Sergeant (500 - 2000 Reputation Level)portcitysoftwar User rank is Sergeant (500 - 2000 Reputation Level)portcitysoftwar User rank is Sergeant (500 - 2000 Reputation Level)portcitysoftwar User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 13 h 18 m 54 sec
Reputation Power: 17
Maybe try breaking it up by limiting 0-10000 uthen do 10001-20000 etc using limit. I'm not sure but maybe beyond the maximum size of an array to load the results of the query in. Could be wrong and I'm sure a more experienced member will correct me.
Quote:
Originally Posted by Penicillin
I have PHP script contains a long loop to list about 60,000 email addresses from mysql, but after 30,000, my php script stops working and brakes, and sometimes all php script is written in white page (my page has imaged background), I increased PHP memory limit to unlimited and set max_execution_time to 0, but no help.

My server has 2GB RAM.

What's problem?

Reply With Quote
  #3  
Old January 6th, 2013, 12:29 AM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Lost in code
Click here for more information.
 
Join Date: Dec 2004
Posts: 7,930 E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 90th Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 2 Months 7 h 39 m 37 sec
Reputation Power: 6991
The first step in fixing a problem is always to figure out what the problem is. It sounds like you have error reporting turned off. Look in the FAQ for several methods of turning it on. Once you've done that, you should get a useful error message when you run the script that will tell you what is going wrong.

It's possible that the script is running out of memory.
__________________
PHP FAQ
How to program a basic, secure login system using PHP

Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
  #4  
Old January 6th, 2013, 12:38 AM
Penicillin Penicillin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 231 Penicillin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 10 h 31 m 40 sec
Reputation Power: 0
Quote:
Originally Posted by E-Oreo
The first step in fixing a problem is always to figure out what the problem is. It sounds like you have error reporting turned off. Look in the FAQ for several methods of turning it on. Once you've done that, you should get a useful error message when you run the script that will tell you what is going wrong.

It's possible that the script is running out of memory.

error reporting is on, and it shows no errors for today.

Anyway, I changed my while loop to save email addresses in one text file using fwrite, and prints nothing in my php page, and this one is working for me, I got all emails in text file.

Reply With Quote
  #5  
Old January 6th, 2013, 06:09 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,833 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 53 m 25 sec
Reputation Power: 811
Um, why are you trying to print 60,000 raw email addresses, anyway?

Reply With Quote
  #6  
Old January 6th, 2013, 03:14 PM
Penicillin Penicillin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 231 Penicillin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 10 h 31 m 40 sec
Reputation Power: 0
Quote:
Originally Posted by Jacques1
Um, why are you trying to print 60,000 raw email addresses, anyway?

Because I wanted to copy then paste them in my mailing list, mailing list is in a separate server, but I noticed that it accepts text file containing email addresses.

Reply With Quote
  #7  
Old January 7th, 2013, 12:31 AM
MSHax MSHax is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Location: SF Bay Area, California
Posts: 2 MSHax User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 27 sec
Reputation Power: 0
Quote:
Originally Posted by Jacques1
Um, why are you trying to print 60,000 raw email addresses, anyway?
LOL! That was my first question too! I was thinking, "definitely not going to help a spammer"

Sounds like your server is timing out. Breaking it up is the easiest way. 60,000 emails don't take up 2gb of ram (although I hope this server isn't used for anything major with only 2gb of ram).

Breaking it up into 10,000s would help a lot, but (12) 5,000 runs would be HELLA faster. From my experience, it seems that after about 6-7k things start getting jankie.

Split it up, recompile on the receiving end and all will go well. (oh yeah, and buy some more ram, it's cheap now. )

Reply With Quote
  #8  
Old January 7th, 2013, 07:11 PM
portcitysoftwar portcitysoftwar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 163 portcitysoftwar User rank is Sergeant (500 - 2000 Reputation Level)portcitysoftwar User rank is Sergeant (500 - 2000 Reputation Level)portcitysoftwar User rank is Sergeant (500 - 2000 Reputation Level)portcitysoftwar User rank is Sergeant (500 - 2000 Reputation Level)portcitysoftwar User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 13 h 18 m 54 sec
Reputation Power: 17
ill keep this guy in mind next time i get an email from the prince of south africa :P

Reply With Quote
  #9  
Old January 7th, 2013, 08:44 PM
Penicillin Penicillin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Posts: 231 Penicillin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 10 h 31 m 40 sec
Reputation Power: 0
Quote:
Originally Posted by MSHax
LOL! That was my first question too! I was thinking, "definitely not going to help a spammer"

Sounds like your server is timing out. Breaking it up is the easiest way. 60,000 emails don't take up 2gb of ram (although I hope this server isn't used for anything major with only 2gb of ram).

Breaking it up into 10,000s would help a lot, but (12) 5,000 runs would be HELLA faster. From my experience, it seems that after about 6-7k things start getting jankie.

Split it up, recompile on the receiving end and all will go well. (oh yeah, and buy some more ram, it's cheap now. )

LOL, I'm not a spammer, I have my own forum with about 60,000 subscribers, and I want to send them new news, and also there is a link to unsubscribe.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP5 - PHP while loop issue

Developer Shed Advertisers and Affiliates



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap