![]() |
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? |
maybe its a time out server side ?
|
Did you try:
set_time_limit(0) ? Maybe it is a timeout somewhere. |
Nah, it gives me a blank screen within 2-3 seconds. So it's dying out during the loop pretty fast.
|
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?
|
Quote:
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. |
Quote:
Quote:
|
Quote:
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. |
wow, didn't even notice we are up to 5.2.1, seems like yesterday when 4.2.1 was out...
|
Quote:
For best idea of what could be changed just review it at php.net :) |
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? :disgust
|
Quote:
|
Quote:
Doesn't anyone use common sense these days? :glugglug |
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. |
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:
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:
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. |
Quote:
PHP Code:
And my phpinfo() looks the same from what I could see. I tried to keep all my settings the same. |
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. |
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:
What type of field/size are you pulling into the array? |
It sounds like your MySQL database has alzheimers.
|
Quote:
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. |
Quote:
Have you got safe mode on or off? Obvious stuff - but I have missed it before on a new server. |
Quote:
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. |
Hi,
try doing PHP Code:
PHP Code:
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. :/ |
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 :thumbsup |
Quote:
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. |
Quote:
|
All times are GMT -7. The time now is 11:20 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123