Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-28-2007, 01:53 PM   #1
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
PHP pro's, got an interesting problem....

I recently upgraded my PHP to 5.2.1 and now have an interesting problem.

I have a query grabbing results from a database. The results then loop in a while loop and get dumped into an array for storage.

The problem is, it worked before.... but now it dies out after it hits a certain point.

I don't get any "out of memory" errors, it just.... stops.

I know the code is ok, I can get results from other queries that don't return as much information, and it worked on 5.2.

I bumped the memory usage to 100Mb in the ini file, and it still dies at the same point.

Thoughts?
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 01:55 PM   #2
Adultnet
Confirmed User
 
Join Date: Sep 2003
Posts: 8,713
maybe its a time out server side ?
__________________


TrafficCashGold Paying Webmasters Since 1996!

Awesome Conversions! Fast Weekly Payments! Over 125 Tours!
Adultnet is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 01:56 PM   #3
psili
Confirmed User
 
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
Did you try:

set_time_limit(0)

?

Maybe it is a timeout somewhere.
__________________
Your post count means nothing.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 02:00 PM   #4
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Nah, it gives me a blank screen within 2-3 seconds. So it's dying out during the loop pretty fast.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 02:14 PM   #5
psili
Confirmed User
 
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
I saw a post made today somewhere about drupal and php 5.2.1 not playing nice with each other - throwing memory errors or something. Not sure what it could be as you'd think a simple loop would run fine. Are you running it from command line or a browser?
__________________
Your post count means nothing.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 02:15 PM   #6
Adultnet
Confirmed User
 
Join Date: Sep 2003
Posts: 8,713
Quote:
Originally Posted by StuartD View Post
Nah, it gives me a blank screen within 2-3 seconds. So it's dying out during the loop pretty fast.
I guess the script page does not receive the variables of the query page.
Try to check the code and look if the page variables are received with $_get or $_post since if this is not determined it might be the problem.
__________________


TrafficCashGold Paying Webmasters Since 1996!

Awesome Conversions! Fast Weekly Payments! Over 125 Tours!
Adultnet is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 02:21 PM   #7
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by StuartD
I know the code is ok, I can get results from other queries that don't return as much information, and it worked on 5.2.
Quote:
Originally Posted by Adultnet View Post
I guess the script page does not receive the variables of the query page.
Try to check the code and look if the page variables are received with $_get or $_post since if this is not determined it might be the problem.
Thanks for the help though.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 02:22 PM   #8
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by psili View Post
I saw a post made today somewhere about drupal and php 5.2.1 not playing nice with each other - throwing memory errors or something. Not sure what it could be as you'd think a simple loop would run fine. Are you running it from command line or a browser?
I run it from within the browser.

I'm pretty sure it is a memory error, but like I said, I'm not getting the error. I turned on _ALL and even turned on the logging to throw errors to the apache error log and yet... I get nothing.

Just a blank page in my browser where I should see results.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 02:44 PM   #9
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
wow, didn't even notice we are up to 5.2.1, seems like yesterday when 4.2.1 was out...
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 03:00 PM   #10
Adultnet
Confirmed User
 
Join Date: Sep 2003
Posts: 8,713
Quote:
Originally Posted by StuartD View Post
Thanks for the help though.
the code could work fine on your last version of php to increase security some defaults were changed and you might need to optimize your code or your php settings.
For best idea of what could be changed just review it at php.net
__________________


TrafficCashGold Paying Webmasters Since 1996!

Awesome Conversions! Fast Weekly Payments! Over 125 Tours!
Adultnet is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 03:01 PM   #11
Nookster
Confirmed IT Professional
 
Industry Role:
Join Date: Nov 2005
Location: Hollywood, CA
Posts: 3,744
try it from the command line, if it doesn't work there than there was a problem with the installation so you'll need to re-install. If it works then it's your software. Doesn't anyone know how to use trial and error these days?
Nookster is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 03:02 PM   #12
Nookster
Confirmed IT Professional
 
Industry Role:
Join Date: Nov 2005
Location: Hollywood, CA
Posts: 3,744
Quote:
Originally Posted by Adultnet View Post
the code could work fine on your last version of php to increase security some defaults were changed and you might need to optimize your code or your php settings.
For best idea of what could be changed just review it at php.net
And yes, that could also be the issue.
Nookster is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 03:06 PM   #13
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by Nookster View Post
try it from the command line, if it doesn't work there than there was a problem with the installation so you'll need to re-install. If it works then it's your software. Doesn't anyone know how to use trial and error these days?
Thanks for your wonderful insight, but yes, I did try it and I still have the same problem, and yes I have re-installed and yes, the loop works 1200 times before it just stops so using $_GET most likely isn't the problem... no matter what new security features there are.

Doesn't anyone use common sense these days?
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 03:10 PM   #14
Damian_Maxcash
So Fucking Banned
 
Join Date: Oct 2002
Location: MaxCash.com
Posts: 12,745
Damn - this came up on a WP forum I was looking at the other day.

I will have a search through my history, but it could have been on my laptop that I have loaned out.

I will get back to you.
Damian_Maxcash is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 03:29 PM   #15
jimbona
Confirmed User
 
Join Date: Jan 2007
Posts: 190
Doing some searching via google, shows many people are suffering from memory leaks on heavy array use, you can see the changes of the PHP core here

Quote:
php.net/ChangeLog-5.php
(sorry could not post url)

You may want to provide some sample code so people can advise/test locally what is failing.

Have you tried checking if anything has changed in your PHP setup with a phpinfo.php page with
PHP Code:
<?php phpinfo();?>
inside.
You can also try putting errors on in php.ini or via .htaccess.

When you get a white page straight away it usally means a code error has taken place so seeing the code could route out the problem. Just because you are using similar code else where and it works, doesnt mean this version does. You could have a rogue .,'" etc etc.
jimbona is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 03:33 PM   #16
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by jimbona View Post
Doing some searching via google, shows many people are suffering from memory leaks on heavy array use, you can see the changes of the PHP core here


(sorry could not post url)

You may want to provide some sample code so people can advise/test locally what is failing.

Have you tried checking if anything has changed in your PHP setup with a phpinfo.php page with
PHP Code:
<?php phpinfo();?>
inside.
You can also try putting errors on in php.ini or via .htaccess.

When you get a white page straight away it usally means a code error has taken place so seeing the code could route out the problem. Just because you are using similar code else where and it works, doesnt mean this version does. You could have a rogue .,'" etc etc.
this is the code:

PHP Code:
while($line mysql_fetch_array($resultMYSQL_ASSOC)){
    
$list[] = $line;

I figured it was a code error at first, because of the white page. However, as I said, if I throw in an output... it'll give me 1200 lines or so before it stops outputting... .without giving an error. It just ends the while statement and then won't output anything following the loop either.

And my phpinfo() looks the same from what I could see. I tried to keep all my settings the same.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 03:52 PM   #17
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
There's been a lot of problems with 5.2.. thankfully 5.2.1 fixed my biggest problem but I'm sure there's more...

I see you have all the logs turned on.. Have you confirmed that it would report an error by "forcing" one in your mysql query? I've been having a lot of issues with my queries where I didn't before so would be interested to know if the query actually works or fails and that the problem is after that.
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 03:58 PM   #18
jimbona
Confirmed User
 
Join Date: Jan 2007
Posts: 190
Hi,

If it is writing 1200 lines a failing, have your tried running a similar query along through PHPmyadmin or similar to see if any of the fields you are pulling are empty.

Do you do any outputting in the page?

try putting in some checking

i.e.

PHP Code:
while($line mysql_fetch_array($resultMYSQL_ASSOC)){ 
    if(!empty(
$line))
    {
        
$list[] = $line;
    }

can you also show a dummy of what $result it?
What type of field/size are you pulling into the array?
jimbona is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 04:26 PM   #19
HomeFry
Confirmed User
 
HomeFry's Avatar
 
Join Date: Jun 2006
Posts: 1,062
It sounds like your MySQL database has alzheimers.
HomeFry is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 04:47 PM   #20
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by jimbona View Post
Hi,

If it is writing 1200 lines a failing, have your tried running a similar query along through PHPmyadmin or similar to see if any of the fields you are pulling are empty.

Do you do any outputting in the page?

try putting in some checking

i.e.

PHP Code:
while($line mysql_fetch_array($resultMYSQL_ASSOC)){ 
    if(!empty(
$line))
    {
        
$list[] = $line;
    }

can you also show a dummy of what $result it?
What type of field/size are you pulling into the array?
That checking is a good idea, however it still blanks out the page if it goes too many rows.

I checked and the mysql_num_rows tells me that there's 2900+ results. So it's pulling the data properly... it's all there.

However once I start looping it and putting it into the array, it dies.

If I alter the code to just output the fields in $line, it outputs everything quite nicely.

It's dumping the information into the array that causes it to choke out.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 05:05 PM   #21
Damian_Maxcash
So Fucking Banned
 
Join Date: Oct 2002
Location: MaxCash.com
Posts: 12,745
Quote:
Originally Posted by StuartD View Post
That checking is a good idea, however it still blanks out the page if it goes too many rows.

I checked and the mysql_num_rows tells me that there's 2900+ results. So it's pulling the data properly... it's all there.

However once I start looping it and putting it into the array, it dies.

If I alter the code to just output the fields in $line, it outputs everything quite nicely.

It's dumping the information into the array that causes it to choke out.
I know you have already checked this, but just in case - whats max_execution_time in php.ini?

Have you got safe mode on or off?

Obvious stuff - but I have missed it before on a new server.
Damian_Maxcash is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 05:07 PM   #22
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by damian2001 View Post
I know you have already checked this, but just in case - whats max_execution_time in php.ini?

Have you got safe mode on or off?

Obvious stuff - but I have missed it before on a new server.
60 seconds, tried changing it in the code to 0 and to 999... neither helped.

And safe mode is turned off.

Good thinking. I hadn't actually checked to see about safe mode, just assumed... but now that you mentioned it, I checked just to be sure.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 05:24 PM   #23
jimbona
Confirmed User
 
Join Date: Jan 2007
Posts: 190
Hi,

try doing

PHP Code:
while($line mysql_fetch_array($resultMYSQL_ASSOC)){  
    if(!empty(
$line)) 
    { 
        
$list[] = $line
        echo 
$line."<br>";
    } 

or
PHP Code:
while($line mysql_fetch_array($resultMYSQL_ASSOC)){  
    if(!empty(
$line)) 
    { 
        
$list[] = $line
    } 
}  
print_r($list); 
See what is last in the line and find out the value after it.
What type of data are you dumping? String?, links? string lengths?

If you want to PM me I could have a direct look if needed to help debug it, im just interested in what would cause such an issue. :/
jimbona is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 05:49 PM   #24
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Ok, I found it... took me forever though!

php 5.2.1 put in a second php.ini file.... one in the php folder and one in the apache folder.

The new one had a memory limit of 8, but it was reporting what I saw in the other php.ini.

And therefore, my memory limit was way lower than I thought it was. Once I changed the second php.ini file, all was good!


Thank you to everyone for helping me to solve this
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 05:52 PM   #25
psili
Confirmed User
 
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
Quote:
Originally Posted by StuartD View Post
Ok, I found it... took me forever though!

php 5.2.1 put in a second php.ini file.... one in the php folder and one in the apache folder.

The new one had a memory limit of 8, but it was reporting what I saw in the other php.ini.

And therefore, my memory limit was way lower than I thought it was. Once I changed the second php.ini file, all was good!


Thank you to everyone for helping me to solve this

I've had the stupid issue happen to me and it drove me crazy where a "ghost" php.ini file existed somewhere. Since then, I try and remind myself to check php_info() and make sure shit's where I think it should be.
__________________
Your post count means nothing.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-28-2007, 11:25 PM   #26
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
Quote:
Originally Posted by StuartD View Post
Ok, I found it... took me forever though!

php 5.2.1 put in a second php.ini file.... one in the php folder and one in the apache folder.

The new one had a memory limit of 8, but it was reporting what I saw in the other php.ini.

And therefore, my memory limit was way lower than I thought it was. Once I changed the second php.ini file, all was good!


Thank you to everyone for helping me to solve this
Glad you got it sorted - I also had a major prob with the 5.2.1 upgrade - as it turned out, the upgrade rearranged the order of loaded extensions and putting mysql.so and pspell.so as the last to load fixed the pb. (took me a while to fix that one!)
__________________

For coding work - hit me up on andy // borkedcoder // com
(consider figuring out the email as test #1)



All models are wrong, but some are useful. George E.P. Box. p202
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.